Legend for different curves on different places in gnuplot png terminal - png

I want to place the titles of two curves on different places. For example for the first curve "set key top right" and for the second curve "set key bottom left" in PNG terminal. Tryind different combinations I got nothing. Where is an error in the following file ? Thank you!
set key top right
plot sin(x)/x
unset key
set key bottom left
replot sin(x)
set term png
set output "file.png"
replot

In general you cannot do this. One workaround is to use multiplot to stack the plots. But, if done properly, this requires you to use fixed margins, so that you may not have a very flexible solution:
set terminal pngcairo
set output 'file.png'
set lmargin 5
set bmargin 2
set multiplot
plot sin(x)/x lt 1
unset tics
unset border
set key bottom left
plot sin(x) lt 2
unset multiplot

You could also use a combination of set arrow and set label commands, e.g.,
set arrow 1 from 6,0.9 to 9,0.9 nohead lt 1
set label 1 'sin(x)/x' at 5.5,0.9 right
set arrow 2 from -4,-0.3 to -7,-0.9 nohead lt 2
set label 2 'sin(x)/x' at -7.5,-0.9 right

Related

How can I put different colors for the different elements of a single dimension

How can I set different colors for the different elements of a single dimension with Tableau Desktop?
I want the colors in fields of dimension and not like the picture.
Thank you
You can drag that same dimension on the Color mark in the Marks area, which by default is displayed below filters, right to the Data area.
To change the colors that Tableau assigns by default you can click on the Color mark and use "Select Colors": it will open a window where you can select the color you want for each value of the dimension you're using.
Edit
Unfortunately you cannot color the background of a dimension axis. You can achieve the same result with a trick though:
Drag the dimension to rows
Double-click in columns and write MIN(1)
From the marks dropdown, make sure Bar is selected
Drag the dimension to the Color mark
Drag the dimension to the Label mark
From the Label mark, set the horizontal alignment to either left or center
From the Label mark, mark the flag to allow labels to overlap other marks
From the Size mark, crank the size all the way up
Right-click on the dimension from the rows area and unselect Show Header
Right click on the MIN(1) axis below the graph, click Edit Axis, select Fixed among the Range options and fix start and end to 0 and 1 respectively
Right click on the MIN(1) from the columns area and unselect Show Header
Of course adjustments can be made to better suit your needs, but this should give you an idea of the whole process.

How to convert axis from nanometer to angstrom in xmgrace?

I have plotted the graph in which the x-axis values are in nanometer. But i want to the x-axis in angstroms.
How can i do this? From axis transform in Xmgrace?
Any suggestions are appreciated.
I think you are asking how to rescale the values of your x data series by a multiplication factor. In your case, in order to convert nm to angstrom you would multiply the x data by 10, e.g. 0.1 nm would become 1 Angstrom.
In the xmgrace GUI menu click Data > Transformations > Evaluate Expression
Method 1: Modifying the original set
In both the "Source" and "Destination" panes select the same set you want to convert so it is highlighted.
In the Formula box type X = X*10 then click Apply.
Method 2: Creating a new set first
On either the "Source" or "Destination" pane right-click on the existing set and Duplicate it.
Now select the original set on the left, and the new set on the right.
In the Formula box type X = X*10 then click Apply.
You can now select either the original or transformed set and hide the other one.
Finally...
In both Methods, now you can set your x axis label to display the updated units.

Google AnnotationChart with only points

Has anyone ever figured out how (if possible) to remove the connecting lines on a Google AnnotationChart?
My goal is to create a scatter plot where the x-axis is time data and the y-axis displays annotated values.
I could use a ScatterChart (or even perhaps a BubbleChart), but the killer-feature of AnnotationChart is the time-aware x-axis and the zoom/scale/scroll feature along that time axis.
I tried hacking around this by turning the option colors to white (the background color), but that also turns all points/annotations to white.
Similarly, there's a line thickness option, but the default (0) is already set and has non-zero thickness.
Other values for thickness I tried: null, undefined, -1... none had any effect.
Any ideas?

gnuplot/tk: how to use tkcanvas support gnuplot command like set style fill set xtics rotate

Now I installed the gnuplot version 4.6 and want to draw some histogram chart using the tkcanvas terminal, but find some commands don't work:
set style fill solid 1.0
But the bar is still empty inside
title
Maybe it is related to the first issue. but in the legend part, beside the title text no bar placed beside to show which color it denotes.
set xtics rotate by -45
The labels along x axis has no rotation
Here is a short example:
set term tk
set style data histograms
set style histogram clustered
set style fill solid 1.0 border lt -1
set xtics rotate by -45
plot for [col=2:5] "histogramdata.txt" using col:xticlabels(1) title columnheader(col)
OK, based on my study I find what the issue. yes, when use tkcanvas as the terminal, the set style fill solid and set xtics rotate both failed. Them can work well for x11 terminals
so the name for this post should be tkcanvas cann't support gnuplot command like: set style fill....
Any idea?
You are doing nothing wrong, the tkcanvas terminal simply doesn't support filled polygons and rotated text, as the test command also tells you:
To see this, use the simple script
set terminal tkcanvas
set output 'test.file'
test
And then, after invoking wish, execute the following Tcl/Tk commands:
source test.file
canvas .c
pack .c
gnuplot .c
which on my system gives

How do I set the default linestyle for plots in MATLAB?

I have an array of data that I would like to plot
temp=0.5*rand(500,10);
[~,offset]=meshgrid(1:500,1:10);
figure(101)
plot(temp+offset')
How can I set the line style to automatically change to the next style once the line colours have been through one cycle?
For this example I would like the 8-10th lines to have a different line style. I can do it manually but I'd like Matlab to do it for me if I can set a default option somewhere.
Your first inclination might be to just change the 'LineStyleOrder' property of the axes before plotting your data. Unfortunately, high-level plotting functions like PLOT will reset the 'LineStyleOrder' property of the axes to it's default value '-'before plotting. One solution is to change the default value used by all axes objects at the root level. For example:
set(0,'DefaultAxesLineStyleOrder',{'-',':'});
Will first use a solid line, then a dotted line, and then repeat again if necessary for each plot. Note that you could also use a custom 'ColorOrder' property with high-level plotting functions by changing the default value at the root as well. The following example will change it so PLOT cycles between only red, green, and blue:
set(0,'DefaultAxesColorOrder',[1 0 0; 0 1 0; 0 0 1]);
Instead of worrying about different line styles, another solution to your problem would be to set the default color order to have more than just 7 colors.
Once default property values on the root are set, they will stay that way until MATLAB is closed. When reopened, the default property values will be set back to their factory-defined values. Commands like CLEAR won't set default properties back to their factory-defined values. Instead, you should set the default property value to 'remove' to undo user-defined values, like so:
set(0,'DefaultAxesLineStyleOrder','remove'); %# Sets the default back to '-'
As another alternative to changing the default properties used by all axes objects, if you change the NextPlot property of an individual axes to anything except 'replace' you can then change the 'LineStyleOrder' or 'ColorOrder' properties to whatever you want and PLOT will not reset them to their defaults. For example, this should do what you want as well:
set(gca,'NextPlot','add','LineStyleOrder',{'-',':'});
plot(temp+offset');