Segmented horizontal line - in spotfire's scatter plot chart - spotfire

I am looking for a way to draw 3 horizontal lines, that each of them will be drawn with different values over specific x-axis values. For example:
Line 1: value= 0.5 for 0 <= x <= 20
Line 2: value= 1.5 for 20 < x <= 30
Line 3: value= 2.5 for 30 < x <= 35
Thanks

Add a line with Lines & Curves/Curve Draw
the formula would look like
if(x>0 AND x<20 , 0.5 ,null)

Related

Plot colour of 3D point based actual value of each data point

I have a 3D array of slopes, X.
I would like to plot each data point and color-code the point based on the actual value. There are three possible values.
if the slope greater 80 then plot data point in red. If the slope greater -80 then blue, else green.
I would also like the legend.
Thanks
I have tried to create a couple of things but not getting it right.
#Make the array to 2D with X, Y, Z axis
X=fits.transpose(2,0,1).reshape(-1,3)
print(X.shape)
kcolors = ['red' if slope greater 0.2 elif slope greater -0.2 'green' else 'blue' for slope in X]
plt.scatter(transformed[:,0], transformed[:,1], transformed[:,2], c=kcolors)
File "<ipython-input-26-4efc22ca2a34>", line 6
kcolors = ['red' if slope > 0.2 elif slope > -0.2 'green' else 'blue' for slope in points]
SyntaxError: invalid syntax
I tried
colors = []
for slope in Xpoints[0]:
if slope > 0.2:
colors.append('r')
elif slope < -0.2:
colors.append('g')
else:
colors.append('b')
This seems to work.
Is there a better way of doing it?

convert x values to minutes or hours

assuming I have data values like those:
8.31
8.25
8.13
8.06
8.00
7.94
7.88
and it is known that they were taken 30 seconds apart each, how can I plot them as minutes or hours in the x axis? I am just confused by not having a separate time column and hpoing gnuplot can do that without adding a new time column to the data file...
I currently use only:
plot 'data.log' u 0:1 with lines lw 2
which of cause give a dimensionless x axis...
Assuming the first point starts at time zero, you can just multiply the pseudo column with 30 to get seconds, e.g.:
plot 'data.log' using ($0 * 30):1 with lines linewidth 2
Output:
As mentioned by Dan in the comments, if you want minutes just divide by 60:
plot "data.log" using ($0 * 30 / 60):1 with lines linewidth 2
reset session
TimeInterval = 30
set xdata time
set format x "%tH:%tM"
plot 'data.log' u ($0*TimeInterval):1 with lines lw 2

How to do horizontal lines from a one column file using gnuplot?

Having a file with just one column of data like for example:
10
2
34
4.5
16
I'd like to plot a stack of horizontal lines as plotting a horizontal line from let's say -3 to 3 (x range) for a y value equal to the first row (10 in the example), then replot a another horizontal line ranging from x=[-3:3] with a y value equal to the second row (2 in the example), and so on.
How can I do it?
Use the vectors plotting style.
plot "file" using (-3):($1):(6):(0) with vectors nohead
The four values in the using expression are x (plain number -3), y (value from first column), dx and dy.

How can I use different point types in the same line in a 2D gnuplot graph?

I'm need to plot one line in which for instance some points may be red circles and some points may be blue circles. Another case is to have in the same line some points represented as filled circles and some points as empty circles. I'd like to know if there's any way to explicitly define which point type should be used for each point or group (interval) of points on the same line.
Please consider a simple dataset such as
1 1.59
2 0.39
3 0.88
4 1.23
5 1.00
In this case I need to use filled cicles for points (3,0.88) and (4,1.23) and use empty circles for the remaining ones.
Here comes an example of what I'd like to do: http://i.stack.imgur.com/VMwfV.jpg
This is very easy to do with a conditional plot. You need to plot the same file twice: once requiring that the points be between 3 and 4 and the rest:
plot "data" using 1:($1 >= 3 && $1 <= 4 ? $2 : 1/0) pt 1, \
"data" using 1:($1 >= 3 && $1 <= 4 ? 1/0 : $2) pt 2
The first plot plots column 2 if the value in column 1 is between 3 and 4 (inclusive) and second plot does the opposite, each plot uses a different point type, as requested:
The number following pt changes the point style.

How to force the uniformly distributed numerical tick marks on the horizontal axis x in Excel graph

I have the table with 2 rows, for simplicity
1 (should define horizontal axis):
0 0.03217 0.04119 0.09613 0.14178 0.17035 0.18824
2 (should define vertical axis):
86 81 80.8 73.8 69 65 63
I need to build a graph (line chart) with row No. 1 as horizontal axis and row No. 2 as vertical axis. The tick marks on the horizontal axis should be 0, 0.02, 0.04 and so forth.
So I select the data for horizontal axis from row 1 and the data for vertical axis from row 2.
However, when I try to format the X axis I do not get the options for any numerical formatting. The options start from Interval between tick marks and so forth.
The options for the vertical axis are completely fine
What can I do?
I assume you want to plot a line that connects your points (0,86), (0.0321,81) .... You should try using a scatter plot graph instead of a line chart.

Resources