1
votes

I am new to gnuplot. I have put the following trying to plot this data.

# Timepoint Cell Number and Viability
# in 1 x 10^7

1   12175000    76.59
2   30575000    93.60
3   87950000    95.84
4   133650000   97.70
5   231500000   97.68

When I input the data without the y2 axis the data was plotted without any problems. However, when I started to put y2 axis and removed it after, gnuplot stopped on plotting the data and started to keep on having errors with a message "Bad format character"

I have tried removing the y2 axis but still gnuplot kept on prompting "Bad format character". I have also tried removing all aesthetics and just put the plot 'datafile' command but still no luck. Please I need help. Thank you.

#Program run for plotting Drosophila cells growth curve

cd 'file location'

set style data linespoints
set title 'Drosophila cells growth curve during induction'

set xrange [0.8:5.2]
set yrange [0:260000000]
set y2range [0:100]
set xlabel 'Hours of culture'
set ylabel 'Cell number'
set y2label 'Percent Viability'
set xtics ('0 hour' 1, '72 hours' 2, '144 hours' 3, '168 hours' 4, '216 hours' 5)
set y2tics ('0%'  0, '10%' 10, '20%' 20, '30%' 30, '40%' 40, '50%' 50, '60%' 60, '70%' 70, '80%' 80, '90%' 90, '100%' 100)

plot 'datafile' using 1:2 lw 3 lc rgb 'black' pt 6 title 'Cell number', 'datafile' using 1:3 lw 3 lc rgb 'red' pt 4 title 'Viability' axis x1y2 

I expect the data to be plotted with 2 y axes but what I get is only a load 'datafile' message with a line 17: Bad format character message

1

1 Answers

1
votes

The "explicit" tics can include formatting information that uses % as a special character. To include it literally, double it:

set y2tics ('0%%'  0, '10%%' 10, '20%%' 20, '30%%' 30, '40%%' 40, '50%%' 50, '60%%' 60, '70%%' 70, '80%%' 80, '90%%' 90, '100%%' 100)