to jitter x-values just add a random number between -0.5 and 0.5
scaled with a fixed value:
w=0.4
plot "myfile" using ($1+w*(rand(0)-0.5)):2
marcel1 wrote:
>
> Hello users,
> I would like to plot data which have various Y values, but share only one
> of two possible x values. to better distinguish datapoints, I would like
> to "jitter" the x values slightly (ie add some random noise to the x
> value). I have looked a lot online, found only a very sparse entry in
> "gnuplot in action" which suggests the following command:
>
>>plot "myfile" u 1:(0.25*rand(0)-.35)
>
> I understand how rand(0) could help, but can't quite figure out how to
> generalize from this to use in my plot instructions which have the form
>
>> plot "myfile" u 1:2 #the 1 data column contains 1s and 2s
>
> so,
>>plot "myfile" u rand(0)*1:2
>
> Strangely, this yields x-values up to 50 whereas i would have expected
> either 1 or 2 times some random decimal <1.
>
>>plot "myfile" u 1*(rand(0):2 # and various other permutations also bad
>
> Clearly I am missing something. Any suggestions welcome.
>
> Thanks,
> marcel
>
>
--
View this message in context: http://old.nabble.com/Help-plotting-%22jittered%22-datapoints-tp28552513p28559149.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|