Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #843 > unrolled thread

Dynamically setting mxtics between two xtics

Started bySatish Thareja <satishthareja@gmail.com>
First post2012-01-11 23:06 -0800
Last post2012-01-23 16:25 +0100
Articles 9 — 6 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Dynamically setting mxtics between two xtics Satish Thareja <satishthareja@gmail.com> - 2012-01-11 23:06 -0800
    Re: Dynamically setting mxtics between two xtics Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-01-12 19:46 +0100
    Re: Dynamically setting mxtics between two xtics sfeam <sfeam@users.sourceforge.net> - 2012-01-12 13:01 -0800
    Re: Dynamically setting mxtics between two xtics Ingo Thies <ingo.thies@gmx.de> - 2012-01-13 10:50 +0100
      Re: Dynamically setting mxtics between two xtics scanty <satishthareja@gmail.com> - 2012-01-18 05:12 -0800
        Re: Dynamically setting mxtics between two xtics Ingo Thies <ingo.thies@gmx.de> - 2012-01-18 18:25 +0100
          Re: Dynamically setting mxtics between two xtics ab <ab.3942@googlemail.com> - 2012-01-19 00:43 -0800
            Re: Dynamically setting mxtics between two xtics scanty <satishthareja@gmail.com> - 2012-01-23 03:38 -0800
              Re: Dynamically setting mxtics between two xtics Ingo Thies <ingo.thies@gmx.de> - 2012-01-23 16:25 +0100

#843 — Dynamically setting mxtics between two xtics

FromSatish Thareja <satishthareja@gmail.com>
Date2012-01-11 23:06 -0800
SubjectDynamically setting mxtics between two xtics
Message-ID<171a69a5-1063-43b2-94e4-c498b855ed2e@a17g2000yqj.googlegroups.com>
I am trying to plot data samples via gnuplot( ver. 4.2.2).
The data is collected with a frequency of 10 minutes and the graphs
are generated dynamically after every data collection process.
Gnuplot automatically adds xtics on the graph, but I am confused on
how does it decide what interval to use.eg:
1. For smaller intervals xtics are positioned at 1 hour, 2 hour
intervals
2. For data spanning from 1 to 5 days xtics are positioned at 12 hour
intervals
3. For Further ahead xtics are positioned at 24 hour intervals

The problem comes when when we want to visualize the data using the
mxtics( minor xtics ), I am not able to decide the number of mxtics to
be inserted between two xtics.

In concise, is there a way so that mxtics are drawn on the graph for
every data sample ( either as an option in gnuplot OR some way to find
out the interval between the xtics to set the mxtics appropriately).

[toc] | [next] | [standalone]


#846

FromHans-Bernhard Bröker <HBBroeker@t-online.de>
Date2012-01-12 19:46 +0100
Message-ID<9n8o38F9f0U1@mid.dfncis.de>
In reply to#843
On 12.01.2012 08:06, Satish Thareja wrote:

> In concise, is there a way so that mxtics are drawn on the graph for
> every data sample ( either as an option in gnuplot OR some way to find
> out the interval between the xtics to set the mxtics appropriately).

No.  Nor should there IMHO ever be such an option.  The x positions of 
your data samples are already displayed as the x positions of the actual 
data.  Putting extra, unlabelled markers at the same x positions serves 
no useful purpose.

[toc] | [prev] | [next] | [standalone]


#847

Fromsfeam <sfeam@users.sourceforge.net>
Date2012-01-12 13:01 -0800
Message-ID<jenhn0$rdh$1@dont-email.me>
In reply to#843
Satish Thareja wrote:

> I am trying to plot data samples via gnuplot( ver. 4.2.2).
> The data is collected with a frequency of 10 minutes and the graphs
> are generated dynamically after every data collection process.
> Gnuplot automatically adds xtics on the graph, but I am confused on
> how does it decide what interval to use.eg:
> 1. For smaller intervals xtics are positioned at 1 hour, 2 hour
> intervals
> 2. For data spanning from 1 to 5 days xtics are positioned at 12 hour
> intervals
> 3. For Further ahead xtics are positioned at 24 hour intervals
> 
> The problem comes when when we want to visualize the data using the
> mxtics( minor xtics ), I am not able to decide the number of mxtics to
> be inserted between two xtics.
> 
> In concise, is there a way so that mxtics are drawn on the graph for
> every data sample ( either as an option in gnuplot OR some way to find
> out the interval between the xtics to set the mxtics appropriately).

Placing a tic mark on the axis for every data point in the graph is
called a "rug plot" or "rug graph" in other plotting packages.

Gnuplot does not offer this as an separate plotting style, but you can
achieve the same effect by using, for example

   plot 'foo' using 1 : 2 : xticlabels("") : yticlabels("")

However this is not precisely what you asked for, since it sets the
xtics and ytics rather than xmtics and ymtics.

[toc] | [prev] | [next] | [standalone]


#848

FromIngo Thies <ingo.thies@gmx.de>
Date2012-01-13 10:50 +0100
Message-ID<9nad3nFvm5U1@mid.individual.net>
In reply to#843
On 12.01.2012 08:06, Satish Thareja wrote:

> In concise, is there a way so that mxtics are drawn on the graph for
> every data sample ( either as an option in gnuplot OR some way to find
> out the interval between the xtics to set the mxtics appropriately).

I am trying to understand what you want to do: You are asking for
separate mxtics scales for each sample, or an mxtic for each data point?

Both should be possible with some external processing and then writing
the tics as arrows where ever you want. A similar thing has been done in
this plot on Wikipedia (although it might have been made with a special
software):

http://upload.wikimedia.org/wikipedia/commons/b/ba/PlanckianLocus.png

Here, the oblique tics and mtics of the color temperature must have been
made by lines with given slopes, and I succeeded to reproduce a similar
plot with gnuplot using arrows.

Your task sounds much simpler since you only need vertical small arrows
placed on the x axis or some parallel axis, and positions defined by
your data. I have also written some algorithm to estimate the
appropriate number of partitions of the tics intervals. As an example:
If the xrange has a width of 10 units, than one might want xtics at 0,
2, 4..., and set mtics 4 (i.e. at 0.5 intervals), but if xscale covers
20, then xtics at 5-intervals and mtics at 1,0-intervals (i.e. set mtics
5) might look better. The algorithm outputs a gnuplot code fragment that
contains the set *tics, set m*tics statements and can be loaded by a
driver script. Two axes could be set this way using both x and x2 axis,
but more than two simultaneous x axes, or tics positioned in some
irregular way (see the color space plot above) would require them to be
drawn as arrows.

If you mean something entirely different, could you please give an
example (maybe ASCII drawing or even a scanned hand drawing or so)?

HTH,

Ingo

[toc] | [prev] | [next] | [standalone]


#855

Fromscanty <satishthareja@gmail.com>
Date2012-01-18 05:12 -0800
Message-ID<3bed6fda-db9e-481c-9e7f-8cf58a01202e@q8g2000yqa.googlegroups.com>
In reply to#848
On Jan 13, 2:50 pm, Ingo Thies <ingo.th...@gmx.de> wrote:
> On 12.01.2012 08:06, Satish Thareja wrote:
>
> > In concise, is there a way so that mxtics are drawn on the graph for
> > every data sample ( either as an option in gnuplot OR some way to find
> > out the interval between the xtics to set the mxtics appropriately).
>
> I am trying to understand what you want to do: You are asking for
> separate mxtics scales for each sample, or an mxtic for each data point?
>
> Both should be possible with some external processing and then writing
> the tics as arrows where ever you want. A similar thing has been done in
> this plot on Wikipedia (although it might have been made with a special
> software):
>
> http://upload.wikimedia.org/wikipedia/commons/b/ba/PlanckianLocus.png
>
> Here, the oblique tics and mtics of the color temperature must have been
> made by lines with given slopes, and I succeeded to reproduce a similar
> plot with gnuplot using arrows.
>
> Your task sounds much simpler since you only need vertical small arrows
> placed on the x axis or some parallel axis, and positions defined by
> your data. I have also written some algorithm to estimate the
> appropriate number of partitions of the tics intervals. As an example:
> If the xrange has a width of 10 units, than one might want xtics at 0,
> 2, 4..., and set mtics 4 (i.e. at 0.5 intervals), but if xscale covers
> 20, then xtics at 5-intervals and mtics at 1,0-intervals (i.e. set mtics
> 5) might look better. The algorithm outputs a gnuplot code fragment that
> contains the set *tics, set m*tics statements and can be loaded by a
> driver script. Two axes could be set this way using both x and x2 axis,
> but more than two simultaneous x axes, or tics positioned in some
> irregular way (see the color space plot above) would require them to be
> drawn as arrows.
>
> If you mean something entirely different, could you please give an
> example (maybe ASCII drawing or even a scanned hand drawing or so)?
>
> HTH,
>
> Ingo

Hi Ingo,

What I want is a mxtic for each data point.
I am not able to figure out how to gnuplot decides the interval of a
xtic.
Can you please share the way to figure out the same.

Thanks,
Satish

[toc] | [prev] | [next] | [standalone]


#856

FromIngo Thies <ingo.thies@gmx.de>
Date2012-01-18 18:25 +0100
Message-ID<9nodjvF3gsU1@mid.individual.net>
In reply to#855
Hi!

> What I want is a mxtic for each data point.
> I am not able to figure out how to gnuplot decides the interval of a
> xtic.
> Can you please share the way to figure out the same.

In this case, I only see the way via arrows. If you have written by
yourself the program that generates the data, then you can include an
output statement to a file that generates lines like

set arrow iarr from xpos,y0 to xpos,y1 nohead

where xpos is the x value of your data point, y0 is the lower y-border
displayed in your graph, and y1 is y0 plus some length.

Another possibility might be to fake tics by using points of type 1
(i.e. crosses) of appropriate size, but this would generate tics in both
directions away from the x-axis. But it could be done inside a gnuplot
script, where you take the x value directly and replace the y value with
the minimum y.

I know, these are more or less dirty hacks, but the former one really
works nicely, and even allows slanted irregular tics (remember the
Planck locus in the color space plot from Wikipedia).

Another hack that might work uses manually set tics using

set xtics ("<label1>" <x1>, "<label2>" <x2>,...)

where "label" stands for any string (in your case maybe just blank), and
x1,x2... stands for your x positions. This, however, would probably
again require some modifications to your data-generating program. Maybe
it could also be done with some awk script, but I am not an expert on
this. If you also want regularly labelled major xtics at the same time
you have to use x2tics instead and set x2range to the same borders as
xrange. I have not yet looked up, but maybe you can set xtics and x2tics
to different styles (i.e. lengths), so that the manually set xtics
appear like minor tics, while the major x2tics have normal size.

In my opinion, the program-generated "set arrow" statements are the
least painful way to do this.

HTH,

Ingo

[toc] | [prev] | [next] | [standalone]


#857

Fromab <ab.3942@googlemail.com>
Date2012-01-19 00:43 -0800
Message-ID<474efc00-f644-4fb6-9b67-7c2b37bbf7e3@18g2000vbx.googlegroups.com>
In reply to#856
Hi,

>
> > What I want is a mxtic for each data point.
> > I am not able to figure out how to gnuplot decides the interval of a

can't you just use

 plot "test.dat" u 1:(0.2)  w impulses

this will draw a line from the x-axis  to 0.2   for each data point.

[toc] | [prev] | [next] | [standalone]


#862

Fromscanty <satishthareja@gmail.com>
Date2012-01-23 03:38 -0800
Message-ID<6589b9fa-e43e-4968-a4d8-d325c83fad78@f11g2000yql.googlegroups.com>
In reply to#857
On Jan 19, 1:43 pm, ab <ab.3...@googlemail.com> wrote:
> Hi,
>
>
>
> > > What I want is a mxtic for each data point.
> > > I am not able to figure out how to gnuplot decides the interval of a
>
> can't you just use
>
>  plot "test.dat" u 1:(0.2)  w impulses
>
> this will draw a line from the x-axis  to 0.2   for each data point.

@Ingo: the arrows work fine, but the length of arrows is creating a
problem as the range of data samples varies between 10-50000.

@ab: The impulses are working fine, but gnuplot is creating a key
( legend ) entry for the impulses.
While key entry for other plots is required( and set by autotitle
columnhead) , can we do something so that the key entry for impulses
is not displayed.

[toc] | [prev] | [next] | [standalone]


#864

FromIngo Thies <ingo.thies@gmx.de>
Date2012-01-23 16:25 +0100
Message-ID<9o5cf4FfgeU1@mid.individual.net>
In reply to#862
On 23.01.2012 12:38, scanty wrote:

> @Ingo: the arrows work fine, but the length of arrows is creating a
> problem as the range of data samples varies between 10-50000.

But the yrange is constant for each plot (i.e. a standard rectangular
coordinate system, unlike the Planck curve example), so you can adjust
the start point and the length of the arrows to an appropriate value.

> @ab: The impulses are working fine, but gnuplot is creating a key
> ( legend ) entry for the impulses.

Yo can add a notitle statement in the plot:

plot <thefile> using <...> notitle with impulses

This omits the key entry.

> While key entry for other plots is required( and set by autotitle
> columnhead) , can we do something so that the key entry for impulses
> is not displayed.

HTH,

Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web