I'm using core plot to draw scattered plot. I have ten data, such as (1,45),(2,54),(3,35),(4,44),...,(9,43),(10,50). The window can show 5 data. If I scroll left, then the window can show other data.
Now the problem is, it always show the first 5 data at first. If I want to show the last 5 data first , how can I do?
Thanks!
The plot space controls what data is visible in the plot area. To display points with x-values between 5 and 10, set the xRange to a range with location 5 and length 5.
Related
i want to plot different errorbars std_a/b/c in my bar graph
a=5; std_a=0.9;
b=6; std_b=0.5;
c=7; std_c=0.2;
%plot
bar([a,b,c]);
errorbar([a,b,c],[std_a,std_b,std_c]);
somehow this is not working. how can get for each bar the correct errorbar?
You're close. errorbar by default plots a line and adds errorbars to it, and if you haven't called hold on or hold all it will overwrite what you already have. If you just want the error bars and not lines between them, give it a plot format that only plots points, like r.:
bar([a,b,c]);
hold on
errorbar([a,b,c],[std_a,std_b,std_c],'r.');
I had to improve location of the error bars on x axis because for more than one data series the bars appear side by side, while the error bars may appear one on top of the other.
for data with two columns and serr (standard error in my case) of the same size I used a shift to the left and right of +-1.4 (see gap in the code below).
gap=0.14;
X=1:length(data);
X=[X'-gap,X'+gap];
errorbar(X,data,serr,'k.');
you can specify a third input argument of zeros the same size of serr, if you want to minimise the bottom bars so that only top error bars show.
I have a bar plot with xlim([1 5]) as time. Each time contains 5 different grouped data. They are very compacted and plot understanding is not clear. I am going to expand each xlim unit to every 5 grouped data be more readable in each time. How is it possible?
Also, How can i make more distance between each 5 grouped data in each time? I applied bar(data,10,'hist'); but my 5 grouped data are still compacted in each time.
You could try bar(X,Y,width), with values of width lower than the default, which is 0.8. However, that only makes the bars narrower, not closer to the each other within its group.
To make the bar groups farther apart, you could insert NaN values between them. For example:
bar(1:.5:3,[ rand(1,7); repmat(NaN,1,7); rand(1,7); repmat(NaN,1,7); rand(1,7)] ,.8)
set(gca,'xtick',1:3) % remove unwanted ticks
See figure:
I have this X axis in my sample project on Core Plot and I wonder how I can customise it a little bit. As you can see it currently has only 3 values on the X axis:
But the values of the two plots I have (the black and grey ones) go far beyond the number of points in the X axis (29 against 3 points). Because of the fact that I have 3 points, only 3 values for each plot are shown.
I would like to keep displaying the remaining 3 points on the axis but accommodate all my 29 events for my plots (they could be displayed in the middle of 1 and 2 point).
How can I do this?
Increase the length of the xRange of the plot space. The value needed depends on the plot data.
I've looked up surface plots and contour plots but cannot find the appropriate format. I am not concerned with height and want a bird's eye view of a flat grid - much like the format of ARCGis.
I have random values between 0 to 10 in a 7x7 matrix.
I want to draw a grid 7 by 7 that is 2D where the individual grid cells are block-coloured according to their value.
The top left value of the matrix is the top left cell of the plot and so on. They should align.
I don't want to have to export matlab's output and put it back into ARCG each time I get a result. Thanks for your advice guys!
If you have a 2D array, you should be able to just "show" it like an image. Try using imagesc() with colormap on. You can change the colormap, size, etc.
My Core Plot is almost finished up but I've noticed an unusual thing I need to change before calling it done. The x axis is scaled properly along the bottom, and the left and right edges indicate the range that I've set. The data, however, is all crushed together on the left side, almost as if the y values are not corresponding to their proper x values.
This image should demonstrate what I mean. You'll notice that the dates run along the bottom, but the actual values don't go past the 6/3/11 mark. They should be all the way to the right.
Link to image
Check the values returned by your datasource. Make sure the x-values are calculated from the same starting date and intervals that you used for the x-axis range and labels.