//Turn off X tick labels and ticks because they don't apply here:
$plot->SetXTickPos('none');
// Format the Y Data Labels as numbers with 1 decimal place.
// Note that this automatically calls SetYLabelType('data').
$plot->SetPrecisionY(0);
$plot->SetXDataLabelPos('none');
$plot->SetXLabelType('data');
$plot->SetPrecisionX(0);
$plot->DrawGraph();
I can't put decimal values in the Y axis, because of that
$plot->SetPrecisionY(0), if I take off this instruction is working properly.
How can I do for not having the integers repeated? It's not always happening,
it depends on the data.
Many thanks in advance!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think you will have to do one or more of these things:
Let the Y axis display decimals with e.g. SetPrecision(2). But you said you can't do this, although I'm not sure why.
Set a specific Y axis range with SetPlotAreaWorld(NULL, $ymin, NULL, $ymax) instead of letting PHPlot calculate it based on your data. You would pick a wider range.
Set either the Y tick increment (SetYTickIncrement(1)), or number of Y tick marks (SetNumYTicks(2)). This reduces the number of tick marks and labels on the Y axis, so they get labeled 3, 4, and 5.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have a problem with some plots because the Y axis values are repeated.
This is my source code:
$plot = new PHPlot(800, 600);
$data = array(array('',25,3.61,""),array('',25,"",4.41),array('',30,4.43,""),
array('',30,"",4.40),array('',35,4.41,""),array('',35,"",4.41));
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
//Set titles
$plot->SetTitle("Example");
$plot->SetXTitle('x axis');
$plot->SetYTitle('y axis');
$plot->SetImageBorderType('plain');
// Set the backgrounds
$plot ->SetDrawPlotAreaBackground(1);
$plot ->SetBackgroundColor("white");
//Define the plot option
$plot->SetPlotType('lines');
//No 3-D shading of the bars:
$plot->SetShading(0);
//Line width
$plot->SetLineWidths(1);
//Turn off X tick labels and ticks because they don't apply here:
$plot->SetXTickPos('none');
// Format the Y Data Labels as numbers with 1 decimal place.
// Note that this automatically calls SetYLabelType('data').
$plot->SetPrecisionY(0);
$plot->SetXDataLabelPos('none');
$plot->SetXLabelType('data');
$plot->SetPrecisionX(0);
$plot->DrawGraph();
I can't put decimal values in the Y axis, because of that
$plot->SetPrecisionY(0), if I take off this instruction is working properly.
How can I do for not having the integers repeated? It's not always happening,
it depends on the data.
Many thanks in advance!
I think you will have to do one or more of these things:
Let the Y axis display decimals with e.g. SetPrecision(2). But you said you can't do this, although I'm not sure why.
Set a specific Y axis range with SetPlotAreaWorld(NULL, $ymin, NULL, $ymax) instead of letting PHPlot calculate it based on your data. You would pick a wider range.
Set either the Y tick increment (SetYTickIncrement(1)), or number of Y tick marks (SetNumYTicks(2)). This reduces the number of tick marks and labels on the Y axis, so they get labeled 3, 4, and 5.