I'm trying to make a general plot where I don't know the range. Sometimes there will be more zero's or a "-" on the tic marks, which causes the graph area to contract. I would prefer the tic labels just extend farther to the left preserving the graph size. This helps with alignment which is a crucial part of these plots.
Does anyone have an idea about how to do this? My searches haven't revealed anything yet.
You can use set lmargin to set a fixed left margin. With e.g. set lmargin 10 you fix the left margin to 10 character widths:
set multiplot layout 2,1
set lmargin 10
set xrange [0:10]
plot x
set xrange[0:100000]
plot x
unset multiplot
Of course, you must still find an appropriate setting for the left margin size.
As another point, also the label position depends on the ticlabel length.
set multiplot layout 2,1
set lmargin 10
set ylabel 'ylabel'
set xrange [0:10]
plot x
set xrange[0:100000]
plot x
unset multiplot
So you would need to change the ylabel position with the offset parameter. To have it more general, you can put the ylabel with a usual set label command to have it fixed independent of the margin settings:
set multiplot layout 2,1
set lmargin 10
set label 1 'manual label' at screen 0.03,graph 0.5 center rotate by 90
set xrange [0:10]
plot x
set xrange[0:100000]
plot x
unset multiplot
Related
I have 3 graphs, each with a different set of y-axis labels (for left axis). This results in the AxisLines for each graph not lining up. Is there a way to set a minimum space that the labels take up?
I've been playing with this;
leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
But I don't like the overall look, even if it does result in the AxisLines aligning.
I'm making plots where the (0,0) position is not necessarily in the bottom left corner of the plot frame, meaning that the x and y axes and their ticks cross within the plot frame. It's fine to have the lines, ticks and their values within the frame, but having the axis titles so near to their lines interferes with visualization of certain data points.
I'd simply like to force the x and y axis titles to be at the bottom and far left of the plot frame, respectively; it doesn't work to simply 'pad' the xlabel or ylabel titles because the padding I'd need would vary between plots.
How to get the titles always in these consistent locations of the plot frame, even if the corresponding axis lines, ticks/values may vary in the plot frame space?
Thank you.
I'd like to add a note here. It seemed to me that it could be possible to define the xlabel and ylabel 'labelpad' values directly from the data range:
For example, one could find the minimum x-value of the minimum y-value (this would set the position of the x-axis label), and the minimum x-value of the minimum x-value (this would set the position of the y-axis label):
xpad = ax.get_ylim()[0]
ypad = ax.get_xlim()[0]
Then use these values in xlabel and ylabel parameters as labelpads:
pylab.xlabel("X Title", fontsize=12, labelpad=abs(xpad))
pylab.ylabel("Y Title", fontsize=12, labelpad=abs(ypad))
Unfortunately, it doesn't look like labelpad can accept variables. Any suggestions that might allow a work-around?
I have a horizontal bar chart where I decided to hide the Y axis and display the axis labels inside the chart:
Now I'd like to know how I can tell Dimple to use the free space (see red rectangle) available from hiding the Y axis.
You set the bounds of the plot area with setMargins or setBounds. Dimple doesn't automatically size to accommodate axes. So just set the left margin to about 10px.
I'm using gnuplot to generate the following surface plot.
The important part of the command file I'm using is:
set terminal pdfcairo size 3,3;
In particular the size 3,3 resizes the plot to the way I want but crops out part of the z-axis label in the process. If I use a wider size like size 4,3 or don't use the size option at all then the z-axis labels fit as follows:
It seems that gnuplot doesn't take the width of the label into consideration when resizing the plot.
Is there a way to maybe move the plot to the right before resizing to 3,3 so that there's room to scientific notation?
You can set the lmargin option:
set lmargin 10
(or whatever size doesn't crop the label).
I'd like the X and Y axes of my Excel charts to have the same scale on the screen, because I'm plotting geographical data. A 1km by 1km square should look like a square, not like a rectangle, i.e. no squishing of the map in one or the other direction. In Matlab, the command that would do this is axis equal.
How do I do this using VBA?
Am I overlooking an even simpler solution directly in Excel?
In addition to guitarthrower's answer you will need to do the following:
Select the 'Plot Area' of the chart and then manually set the height and width of the plot area.
Sheets("Chart1").PlotArea.Select
Selection.Height = 500
Selection.Width = 500
Just setting the axis min and max values will still allow the chart to be 'squished'.
When you select the plot area and write Selection.Width = something, the Width value you are setting also includes the width of the axis labels/text. This may not be what you want.
Instead, you can set the INSIDE Width/Height value using
Selection.InsideHeight = 250
Selection.InsideWidth = 250
Another method similar to Stewbob's is to set the limits to some ratio of each other (my plots are 4 times as wide as they are tall) and then use the height to set the width.
ActiveChart.PlotArea.Select
Selection.Width = Selection.Height * 4