I'm setting the legend with 2 entries.
First, I had a problem that there was white space on the left of the first entry and I added 'width -2' in the 'set key' syntax.
After that, the entries are slightly overlapped. The result is:
The 'set key' syntax what I used is:
set key reverse at screen 0.8, 0.05 spacing 1.5 samplen 2 font ",10"
set key box width 1 vertical maxrows 1
What I want is two:
Removing the left white space
Keeping the gap between the legend entries
Thanks!
== Update ==
I modified the 'set key' syntax with #Ethan Merritt's advise.
However, the left white space still remains like this:
I want to reduce the left white space in the key box and to adjust the gap between the entries, like this:
I also update the 'set key' syntax I used above.
Please help me once more.
"remove the left white space" - to left-justify the text, say set key Left.
This will affect all entries in the key box, not just the leftmost one.
"keep the gap between entries" - do not squeeze the box with width -2
Related
Dear Experts of gnuplot,
I want to change the spacing between key text and key symbol.
Please help me with this. What command should I use for the purpose?
Thanks in advance.
The space between symbol and key entry is so large because it is reserved for line plots:
plot sin(x) with points, cos(x) with lines
If you mix these two styles in one figure, you will want to keep the horizontal spacing. However, if you are sure that you will use only points, then the horizontal space might indeed seem too large. The samplen option of set key can be used for that purpose, it can even be set to negative: set key samplen -1 (default is 4)
Please have a look at the attached plot created from Gnuplot. I am facing two issues with it.
1) The empty white space in the left side of the key box (legend box). Is there any way to remove that extra empty white space? Neither I want to lose the key box nor compromise on the Greek letters used. Also, note that final output format has to be eps.
2) There is also too much space between the y-axis and the y-label. How to optimize it?
Please help.
Gnuplot_Image
Gnuplot doesn't know the exact width and height of the ultimately formatted strings. It rather tries to approximate the width based on some font information. That does also happen when using e.g. the qt terminal with a title containing only very narrow letters:
set terminal qt
set key box
plot x title 'iiiiiiiiiii'
That becomes even more complictated when TeX strings are involved. Use the width parameter for set key with a narrow value to decrease the key's width. You must manually estimate the actual value to use:
set terminal qt
set key box width -6
plot x title 'iiiiiiiiiii'
The same argumentation applies to the positioning of xlabel and ylabel. Here, you must use the offset parameter to correct the position:
set xlabel 'xlabel' offset 0, -0.5
set ylabel 'ylabel' offset 0.5, 0
How can I place the key some distance from a given border? For instance if I run set key below I can place the key below the graph, but it's too close and actually overlaps the xlabel. How can I place it some distance further, something like set key below 1 to put it 1 below the default below position?
To clarify, I know I can place it manually with set key at x,y, but that involves manually looking for the right place. This requires manual calculation and adjustment to, for example, get it centered. I just want to put it a bit below its default below position.
You could add a little extra height to the legend so that there is effectively more space between the bottom border of the plot and the legend content:
set key below height 2
set xlabel "this is the x axis label"
plot sin(x)
gives
Please have a look at the attached plot created from Gnuplot. I am facing two issues with it.
1) The empty white space in the left side of the key box (legend box). Is there any way to remove that extra empty white space? Neither I want to lose the key box nor compromise on the Greek letters used. Also, note that final output format has to be eps.
2) There is also too much space between the y-axis and the y-label. How to optimize it?
Please help.
Gnuplot_Image
Gnuplot doesn't know the exact width and height of the ultimately formatted strings. It rather tries to approximate the width based on some font information. That does also happen when using e.g. the qt terminal with a title containing only very narrow letters:
set terminal qt
set key box
plot x title 'iiiiiiiiiii'
That becomes even more complictated when TeX strings are involved. Use the width parameter for set key with a narrow value to decrease the key's width. You must manually estimate the actual value to use:
set terminal qt
set key box width -6
plot x title 'iiiiiiiiiii'
The same argumentation applies to the positioning of xlabel and ylabel. Here, you must use the offset parameter to correct the position:
set xlabel 'xlabel' offset 0, -0.5
set ylabel 'ylabel' offset 0.5, 0
I would like to ask for your help on two major problems I have with an Excel (2003) chart:
1) I would like to create a chart which has got 25 grids (5 on the x axis and 5 on the y axis). The number of grids must not change, i.e. data should have no impact on the size, length and number of grids (several different worksheets are used as input to the chart). How can I create such a chart without having different grid lenghts depending on data?
2) I need a chart which has 25 grids, with each grid being colored differently, e.g. for example 3 grids in the upper right corner are red, 3 grids in lower left corner are green, inbetween all grids are colored white. I have read some articles on creating charts with a quadrant background, i.e. 4 grids, each having a different color. But I would like to know how I can create multi colored background for 25 grids?
Many thanks in advance!!
Regards,
Since you don't want to use VBA, there are a number of hand steps that are needed to create the grid chart you are looking for. For the most part, these steps can be taken in any order.
Enter what will be the horizontal column labels in a 1 x 5 cell range in your worksheet.
In the 5 x 5 cell range immediately below, enter the value 1 in each cell.
Selecting the 6 x 5 cell range, insert a 100% Stacked Column chart into the worksheet. You will now have a chart with of bars with five horizontal bands, each of a different color.
Delete the legend.
Select one of the bands to format and set its Gap Width to "No Gap."
Insert a chart title and horizontal and vertical axis titles, if any.
Select each band (data series) and set its fill color to solid fill white and its border color to solid line black.
Select the chart area and set its height and width to identical values.
Lock the chart area's aspect ratio.
Select and set the fill color of each data point (grid cell) that you want in a contrasting color.
(I am unaware of any way to dynamically set the colors of the grid cells based upon different data values, other than via VBA.)
If you want to change the font size of the labels of one of the axes, be sure to set the other axis to the same size to preserve the square grid layout.
Set the major tick mark type of the vertical axis to None, and the font color of the vertical axis labels to white.
At this point, you may want to shift the plot area to the left so that there is more white space between the right borders of the plot area and the chart area.
Select the chart area and then insert a text box over the vertical axis label area.
Enter into the text box the vertical axis labels that you want to show, with a blank line between each label, and with the font size and color of your choice.
Move the text box vertically so that, by eye, the first of labels in the text box is by eye aligned vertically with the center of the top row of the grid.
Select the blank line between the first two labels in the text box and change the line's font size so that, again by eye, the second label is aligned vertically with the center of the second grid row. Continue with the three remaining labels.
If you want finer control of the alignment of the labels, insert a second line between the each pair of labels and set the font size for the second lines in a smaller font than the first lines.
This text box is the only element of the chart that will not automatically resize if you change the size of the chart.
Other than any minor tweaking of the font sizes or alignment of the chart title and the axis labels, the chart is done: