Insufficient accuracy on tick mark labels on HPlot - reichold - 09-11-2015 03:33 AM
Please excuse formatting blunders, its the first time I use this forum.
The small Java example code below produces a large number of points of a sinusoidal function, stores them in a P1D and that gets displayed via an HPlot.
If you zoom on the horizontal axis into the area beyond 1E6 until you see only a few oscillations you will notice that the tick mark labels on the horizontal axis all show the same number and the axis gets automatically labelled with a scale factor of 10^6. (see the attached picture) I.e. there is not sufficient accuracy to display the tickmarks once the numbers are displayed in scientific or exponential notation.
Could somebody tell me how I can increase the accuracy (number of significant digits) of axis tick mark labels in an HPlot ?
regards
Armin
Code:
package plotproblemdemo;
import jhplot.HPlot;
import jhplot.P1D;
public class PlotProblemDemo {
public static void main(String[] args) {
// TODO code application logic here
String p1DName = "My p1D";
P1D myP1D = new P1D(p1DName);
myP1D.setLineStyle(1);
myP1D.setDrawSymbol(false);
double start = 0;
double end = 2000000;
double period = 100;
double amplitude = 1;
double y;
for (double x = start; x <= end; x+=10) {
y = amplitude * Math.sin(x/period);
myP1D.add(x, y);
}
int width = 900;
int height = 500;
String hPlotName = "My HPlot";
HPlot myHPlot = new HPlot(hPlotName, width, height, 1, 1);
myHPlot.setRangeX(start, end);
myHPlot.setRangeY(-(amplitude*1.1),+(amplitude*1.1));
myHPlot.visible();
myHPlot.draw(myP1D);
}
}
RE: Insufficient accuracy on tick mark labels on HPlot - sergei175 - 09-12-2015 09:01 AM
Hello, Armin
It is usually not recommended to use HPlot when the number of points is so large, since the canvas requires to much memory. Try to use SPlot or HPlotXY.
This example seems works:
Code:
from jhplot import *
from java.lang import Math
p1DName = "My p1D";
myP1D = P1D(p1DName);
myP1D.setLineStyle(1);
myP1D.setDrawSymbol(False);
start = 0;
end = 2000000;
period = 100;
amplitude = 1;
for x in range(start,end,10):
y = amplitude * Math.sin(x/period)
myP1D.add(x, y)
width = 900;
height = 500;
hPlotName = "My HPlot";
# myHPlot = HPlotXY(hPlotName, width, height);
myHPlot = SPlot(hPlotName, width, height);
myHPlot.visible();
myHPlot.setRange(start, end, -(amplitude*1.1), +(amplitude*1.1));
myHPlot.draw(myP1D);
|