How do you accurately set the offset of an axisLabel in CorePlot? - iphone

Problem Statement:
A bar plot in created with CorePlot has a Y-axis that features a dynamic range. The minimum value of this range is presumed to be <= 0. The maximum value of the range is presumed to be > 0.
The bar plot features custom X-axis labels which have an offset to distance themselves from the 0 line of the Y-axis. (label.offset)
However, because the exact location of the 0 line may change during runtime, a static value to offset the X-axis labels is not sufficient.
Question:
What is the appropriate way to accurately set the offset of Axis labels, when axis parameters change at runtime?
Screenshot attached to show problem. Labels should be below the ($200,000) line, but because the top end value is dynamic, they move up and down.
http://i.imgur.com/jdwy1c2.png

From the linked picture, it doesn't look like you're drawing the axis line. Use axis constraints to hold the x-axis at the bottom of the plot area. If you do want to draw an axis line, e.g., at y = 0, add a second x-axis. Use one to draw the axis line and the other to position the labels. Set all of the line style properties of the second axis to nil so it doesn't draw any lines and use constraints to hold it at the bottom of the plot area.

Related

Bubble charts Vaadin: how can i set the axes origin on coordinates 0,0

Now vaadin set X axis on min vertical value(bottom) and Y axis on min horizontal value (left), but i will like set axes on middle
I'm afraid that axis are always in left and bottom of the plot area.
One thing you can do is set the min at negative, or leave it automatic, and add a plotline with value 0 for both axes. That way you can visualize the chart's quadrants.
If you're using java API you can use addPlotLine method in xAxis or yAxis classes. You can check the java tab in the boxplot demo

Add labels for x and y using the plotmatrix function MATLAB

I managed to plot a matrix (16X16) but I want to add labels for each single x and y axis's. As shown below, the labels are written vertically on the y and mixed with each other and also written on the x graph itself and also mixed. Is there a way to add the labels beside the axis without being mixed (as show in the second photo)?
Current graph:
What I want to do:
My code (just stopped after plotting three label as it wasn't working):
[~,ax] = plotmatrix(corr);
ylabel(ax(1,1),'ABCDEFGHIJKLMNOP')
ylabel(ax(2,1),'ABCDEFGHIJKLMNOP')
ylabel(ax(3,1),'ABCDEFGHIJKLMNOP')
xlabel(ax(16,1),'ABCDEFGHIJKLMNOP')
xlabel(ax(16,2),'ABCDEFGHIJKLMNOP')
xlabel(ax(16,3),'ABCDEFGHIJKLMNOP')
If I understand your problem you want to be able to give individual y-labels for the rows and x-labels for the columns. Unfortunately when you use xlabel and ylabel the resulting text overlaps. Here are two solutions
Solution 1: Use the big-axes to set the labels
Use single label for the horizontal axis and vertical axis by referencing the big-axes
[~,~,HBigAxe] = plotmatrix(corr);
xlabel(HBigAxe,'Horizontal Label for Columns');
ylabel(HBigAxe,'Vertical Label for Rows');
Solution 2: use rotation and alignment to avoid overlapping labels
If you want each row and column to have there own labels you can rotate and set the horizontal alignment of the label. For example:
[~,ax] = plotmatrix(corr);
ylabel(ax(1,1),'Y Axis Label','Rotation',0,'HorizontalAlignment','right')
xlabel(ax(end,1),'X Axis Label','Rotation',90,'HorizontalAlignment','right')

about aligning the xlabel to center of the axis in matlab 3D figure

I am plotting some 3D data in matlab and trying to rotate the xlabel such that it orients the same direction as the xaxis. I fix the view for the current 3D figure to some angle and with trail and error I found the correct angle to rotate the label.
view(al, ae); % where al and ae is the parameter for the view I want
theta = 52; % this angle is obtained by trail and error
xlabel('label at some angle', 'rot', theta)
Now the label oriented in the right direction but I found that it is no longer stay in the center of the corresponding axis, i.e. the center of the label no longer line up with the center of the x-axis. Is that any way to align them again?
Actually, I try something like enter link description here, but it doesn't work very well for the view. By following the idea in that link, I try something like
xf = 1.2*min(get(gca, 'xlim')); % in my case zero is the middle or the xlim
yf = 1.2*min(get(gca, 'ylim')); % in my case zero is the middle or the ylim
set(get(gca,'XLabel'),'Position', [0, yf, zf]);
set(get(gca,'YLabel'),'Position', [xf, 0, zf]);
set(get(gca,'xlabel'),'rot',thetax);
set(get(gca,'ylabel'),'rot',thetay);
set(get(gca,'zlabel'),'rot',thetaz);
So with above code, I set the position of the label to somewhere close to the center of the corresponding axis before rotation. If the label has only one character, then it works. But if the label is long, then it will have the first character aligned with the center of the axis instead. The reason is I didn't taking the length of the label into account. I know I should but the problem is how much should I offset the label from the center of the axis? I only know the size of the font and total number of characters of the label, how do I found out the actual length of the label? Thanks.

Core Plot :Move only Data

I have created a scatter graph with three plot spaces. One for two y-axis each and one for the x-axis. I am able to show data for both y-axis. However now i want to move only the data,i.e. two line and not the two y-axis.Only the data and x-axis should move.
I have tried allowUserinteraction property. However is I enable it for x-axis, x axis moves without the data. If i enable it for both/either of axis, y axis also moves with data and scale of y-axis is not visible all the time. Can someone help pleas.e This is my first work with core plot.
I will add code if required.
Thanks
Since each plot space has both x and y ranges, I would just use two plot spaces for this situation. Use the same xRange for both plot spaces and assign the x-axis to one of them.
The easiest way to make them scroll only in the X direction is to set the globalYRange to the same range as the yRange for both plot spaces. Set allowsUserInteraction to YES for both plot spaces. If you need to change the yRange later, set the globalYRange to nil before you change the yRange and reset it afterwards. If you ever update the X range manually, be sure to always set it on both plot spaces.

Core Plot Bar Chart Columns

Is it possible to set some padding between the first bar and the Y axis?
The last bar is always a few pixels away from the right margin of the plot but the first column always appears cut by the Y axis
Adjust the xRange of your plot space. Decrease the starting location and increase the length.