|
| Hi, everyone. I'm trying to set a graphic with two axis (y1 and y2),
and two data sets for each axis. The trouble is: when the graphic is
loaded in a browser the right axis and the scale disappear. Somebody
can help me? the code is the following:
#!/usr/bin/perl -w
use GD::Graph::mixed;
@data = (
#D
["0", "0.01", "0.02", "0.03","0.04", "0.05", "0.06", "0.07", "0.08",
"0.09", "0.1", "0.11",
"0.12", "0.13", "0.14", "0.15", "0.16", "0.17", "0.18", "0.19", "0.2",
"0.21",
"0.22", "0.23", "0.24", "0.25", "0.26", "0.27", "0.28", "0.29", "0.3", "0.31", "0.32",
"0.33", "0.34", "0.35", "0.36", "0.37", "0.38", "0.39", "0.4", "0.41", "0.42", "0.43",
"0.44", "0.45", "0.46", "0.47", "0.48", "0.49", "0.5"],
#X
[0, 0.1298701,
0.1818182, 0.2597403, 0.3246753, 0.3636364, 0.4415584, 0.4935065, 0.4935065, 0.5454545,
0.6363636, 0.7012987, 0.7272727, 0.7532468, 0.8051948, 0.8181818, 0.8181818, 0.8441558, 0.8571429, 0.8701299, 0.8701299, 0.8701299, 0.8701299, 0.8701299, 0.8961039, 0.8961039, 0.9220779, 0.9350649, 0.961039, 0.961039, 0.974026, 0.974026, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
#diff-XY/X
[0,
0.0001687, 0.0026986, 0.001518, 0.0026986, 0.0001687, 0.0001687, 0.0001687, 0.0042166, 0.0060719, 0.0001687, 0.0026986, 0.0006747, 0, 0, 0.0001687, 0.0006747, 0.0001687, 0, 0.0001687, 0.0001687, 0.0001687, 0.0001687, 0.0001687, 0.0001687, 0.0001687, 0.001
518, 0.0026986, 0.0001687, 0.0001687, 0.0006747, 0.0006747, 0.001518, 0.001518, 0.0001687, 0.0001687, 0.0001687, 0.0001687, 0. 0001687, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
, 0],
#XY
[0,
0.1168831,0.1298701, 0.2207792, 0.2727273, 0.3766234, 0.4545455, 0.5064935, 0.5584416, 0.6233766, 0.6233766, 0.6493506, 0.7012987, 0.7532468, 0.8051948, 0.8311688, 0.8441558, 0.8571429, 0.8571429, 0.8571429, 0.8571429, 0.8571429, 0.8831169, 0.8831169, 0.8
831169, 0.8831169, 0.8831169, 0.8831169, 0.9480519, 0.9480519, 0.9480519, 0.9480519, 0.961039, 0.961039, 0.987013, 0.987013, 0.987013, 0.987013, 0. 987013, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1],
#95%XY
[0, 0.0107944004, 0.013661663,
0.0204081633, 0.0204081633, 0.0204081633, 0.0204081633, 0.0204081633, 0.0204081633, 0.0204081633, 0.0168662506, 0.013661663,
0.013661663, 0.0107944004, 0.0107944004, 0.0082644628, 0.0082644628, 0.0060718502, 0.0042165627, 0.0042165627, 0.0042165627, 0.0042165627, 0.0042165627, 0.0042165627, 0.0042165627, 0.0026986001, 0.0042165627, 0.0026986001, 0.0026986001, 0.0015179626, 0.00
15179626, 0.0015179626, 0.00067465,
0.0015179626, 0.00067465,
0.0001686625, 0.0001686625, 0.0001686625, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0]
);
my $my_graph = GD::Graph::mixed->new(600, 500);
$my_graph->set(
title => "MA01 vs. MA02",
x_label => "Distance (D)",
y1_label => "Covarage (C)",
y2_label => "C((Cx-Cxy)2)",
x_labels_vertical => 1,
x_label_position => 1/2,
x_min_value => 0,
y1_min_value => 0,
y2_min_value => 0,
x_max_value => 0.5,
y1_max_value => 1,
y2_max_value => 0.25,
x_tick_number => 10,
y_tick_number => 10,
x_label_skip => 2,
y_label_skip => 2,
two_axes => 1,
use_axis => [1,2,1,2],
legend_placement => "BR",
types => ["points", "lines", "points", "lines"],
markers => [7,0,8,0],
) or die $my_graph->error;
$my_graph->set_legend( "X", "95%XY", "XY", "diff-XY/X");
my $gd = $my_graph->plot(\@data) or die $my_graph->error;
open(IMG, ">grafico.png") or die "Can't open file $!\n";
binmode IMG;
print IMG $gd->png;
close IMG;
|
|