[Graph-dev] setting different format for X and Y axis
Emile Aben
emile at caida.org
Thu May 24 10:18:01 PDT 2007
Hi,
Thanks for this feedback.
Chart::Graph::Gnuplot offers the ability to 'break out' to write
raw gnuplot directives with the 'extra_opts' option, so
something like this should work (untested):
gnuplot(
{
... your options here ...
extra_opts => [
'set format x "%m/%d\\n%H:%M:%S"',
'set format y "%.1f"'
]
},
... data set options ...
)
Also using a combination of timefmt and format options should help in
your case I think, something like this should work (also untested):
gnuplot(
{
...
'xdata' => 'time',
'timefmt' => '%m/%d\\n%H:%M:%S',
'format' => ['y','.1f'],
...
}
...
)
That being said, I'm thinking of introducing the functionality you want
directly into the 'format' option, since it seems generally useful.
hope that helped,
Emile
CAIDA/SDSC/UCSD
On Mon, May 21, 2007 at 06:55:36AM -0400, Britt Houser wrote:
> I have a need to set both the X and Y axis formats. From my read off
> the code, this doesn't appear to be supported. This is the lines I'm
> referring to:
>
> # The only time related Gnuplot code that doesn't need to be
> # output first.
> if ($key eq "format") {
> if (defined($value)) {
> if(ref($value) eq "ARRAY") {
> # Print value supplying quotes for time format.
> print $handle "set $key ", $$value[0]," \"",
> $$value[1], "\" \n";
> } else {
> carp "Invalid setting for format option";
> }
> }
> }
>
>
> So only the first two elements in the array are considered. Is there
> another way I'm missing to get multiple format statements entered?
> Seems like if it were changed to:
>
> # The only time related Gnuplot code that doesn't need to be
> # output first.
> if ($key eq "format") {
> if (defined($value)) {
> if(ref($value) eq "ARRAY") {
> for {my $j=1;$j <=$#$value;$j+=2} {
> my $i=$j-1;
> # Print value supplying quotes for time format.
> print $handle "set $key ", $$value[$i]," \"",
> $$value[$j], "\" \n";
> } else {
> carp "Invalid setting for format option";
> }
> }
> }
>
> Then you could specify multiple axis format statements like this:
> my %default_args = (
> "format" => ["x", "%m/%d\\n%H:%M:%S" , "y" , "%.0f"],
> ...
>
> What do you think?
>
> thx,
> britt
>
>
> --
> ...but we also rejoice in our sufferings, because we know that
> suffering produces perseverance; perseverance, character; and
> character, hope. And hope does not disappoint us... Romans 5:3-5.
>
> _______________________________________________
> Graph-dev mailing list
> Graph-dev at caida.org
> https://rommie.caida.org/mailman/listinfo/graph-dev
More information about the Graph-dev
mailing list