@@ -301,6 +301,13 @@ public static <T extends Number> void plotLine(final String labelID, final T[] x
301
301
nPlotLine (labelID , x , y , x .length , offset );
302
302
}
303
303
304
+ /**
305
+ * Plots a standard 2D line plot.
306
+ */
307
+ public static void plotLine (final String labelID , final double [] xs , final double [] ys , final int size , final int offset ) {
308
+ nPlotLine (labelID , xs , ys , size , offset );
309
+ }
310
+
304
311
private static native void nPlotLine (String labelID , double [] xs , double [] ys , int size , int offset ); /*
305
312
ImPlot::PlotLine(labelID, xs, ys, size, offset);
306
313
*/
@@ -325,6 +332,10 @@ public static <T extends Number> void plotScatter(final String labelID, final T[
325
332
nPlotScatter (labelID , x , y , x .length , offset );
326
333
}
327
334
335
+ public static void plotScatter (final String labelID , final double [] xs , final double [] ys , final int size , final int offset ) {
336
+ nPlotScatter (labelID , xs , ys , size , offset );
337
+ }
338
+
328
339
private static native void nPlotScatter (String labelID , double [] xs , double [] ys , int size , int offset ); /*
329
340
ImPlot::PlotScatter(labelID, xs, ys, size, offset);
330
341
*/
@@ -349,6 +360,13 @@ public static <T extends Number> void plotStairs(final String labelID, final T[]
349
360
nPlotStairs (labelID , x , y , x .length , offset );
350
361
}
351
362
363
+ /**
364
+ * Plots a a stairstep graph. The y value is continued constantly from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i].
365
+ */
366
+ public static void plotStairs (final String labelID , final double [] xs , final double [] ys , final int size , final int offset ) {
367
+ nPlotStairs (labelID , xs , ys , size , offset );
368
+ }
369
+
352
370
private static native void nPlotStairs (String labelID , double [] xs , double [] ys , int size , int offset ); /*
353
371
ImPlot::PlotStairs(labelID, xs, ys, size, offset);
354
372
*/
@@ -394,10 +412,24 @@ public static <T extends Number> void plotShaded(final String labelID, final T[]
394
412
nPlotShaded (labelID , x , y1 , y2 , x .length , offset );
395
413
}
396
414
415
+ /**
416
+ * Plots a shaded (filled) region between two lines, or a line and a horizontal reference. Set yRef (default 0) to +/-INFINITY for infinite fill extents.
417
+ */
418
+ public static void plotShaded (final String labelID , final double [] xs , final double [] ys , final int size , final int yRef , final int offset ) {
419
+ nPlotShaded (labelID , xs , ys , size , yRef , offset );
420
+ }
421
+
397
422
private static native void nPlotShaded (String labelID , double [] xs , double [] ys , int size , int yRef , int offset ); /*
398
423
ImPlot::PlotShaded(labelID, xs, ys, size, yRef, offset);
399
424
*/
400
425
426
+ /**
427
+ * Plots a shaded (filled) region between two lines, or a line and a horizontal reference.
428
+ */
429
+ public static void plotShaded (final String labelID , final double [] xs , final double [] ys1 , final double [] ys2 , final int size , final int offset ) {
430
+ nPlotShaded (labelID , xs , ys1 , ys2 , size , offset );
431
+ }
432
+
401
433
private static native void nPlotShaded (String labelID , double [] xs , double [] ys1 , double [] ys2 , int size , int offset ); /*
402
434
ImPlot::PlotShaded(labelID, xs, ys1, ys2, size, offset);
403
435
*/
@@ -432,6 +464,14 @@ public static <T extends Number> void plotBars(final String labelID, final T[] x
432
464
nPlotBars (labelID , x , y , x .length , width , offset );
433
465
}
434
466
467
+ /**
468
+ * Plots a vertical bar graph.
469
+ * @param width is in X units
470
+ */
471
+ public static void plotBars (final String labelID , final double [] xs , final double [] ys , final int size , final float width , final int offset ) {
472
+ nPlotBars (labelID , xs , ys , size , width , offset );
473
+ }
474
+
435
475
private static native void nPlotBars (String labelID , double [] xs , double [] ys , int size , float width , int offset ); /*
436
476
ImPlot::PlotBars(labelID, xs, ys, size, width, offset);
437
477
*/
@@ -466,6 +506,14 @@ public static <T extends Number> void plotBarsH(final String labelID, final T[]
466
506
nPlotBarsH (labelID , x , y , x .length , height , offset );
467
507
}
468
508
509
+ /**
510
+ * Plots a horizontal bar graph.
511
+ * @param height is in Y units
512
+ */
513
+ public static void plotBarsH (final String labelID , final double [] xs , final double [] ys , final int size , final float height , final int offset ) {
514
+ nPlotBarsH (labelID , xs , ys , size , height , offset );
515
+ }
516
+
469
517
private static native void nPlotBarsH (String labelID , double [] xs , double [] ys , int size , float height , int offset ); /*
470
518
ImPlot::PlotBarsH(labelID, xs, ys, size, height, offset);
471
519
*/
@@ -492,6 +540,13 @@ public static <T extends Number> void plotErrorBars(final String labelID, final
492
540
nPlotErrorBars (labelID , x , y , errOut , x .length , offset );
493
541
}
494
542
543
+ /**
544
+ * Plots vertical error bar. The labelID should be the same as the labelID of the associated line or bar plot.
545
+ */
546
+ public static void plotErrorBars (final String labelID , final double [] xs , final double [] ys , final double [] err , final int size , final int offset ) {
547
+ nPlotErrorBars (labelID , xs , ys , err , size , offset );
548
+ }
549
+
495
550
private static native void nPlotErrorBars (String labelID , double [] xs , double [] ys , double [] err , int size , int offset ); /*
496
551
ImPlot::PlotErrorBars(labelID, xs, ys, err, size, offset);
497
552
*/
@@ -518,6 +573,13 @@ public static <T extends Number> void plotErrorBarsH(final String labelID, final
518
573
nPlotErrorBarsH (labelID , x , y , errOut , x .length , offset );
519
574
}
520
575
576
+ /**
577
+ * Plots horizontal error bar. The labelID should be the same as the labelID of the associated line or bar plot.
578
+ */
579
+ public static void plotErrorBarsH (final String labelID , final double [] xs , final double [] ys , final double [] err , final int size , final int offset ) {
580
+ nPlotErrorBarsH (labelID , xs , ys , err , size , offset );
581
+ }
582
+
521
583
private static native void nPlotErrorBarsH (String labelID , double [] xs , double [] ys , double [] err , int size , int offset ); /*
522
584
ImPlot::PlotErrorBarsH(labelID, xs, ys, err, size, offset);
523
585
*/
@@ -543,6 +605,13 @@ public static <T extends Number> void plotStems(final String labelID, final T[]
543
605
nPlotStems (labelID , v , v .length , yRef , offset );
544
606
}
545
607
608
+ /**
609
+ * Plots vertical stems.
610
+ */
611
+ public static void plotStems (final String labelID , final double [] values , final int size , final int yRef , final int offset ) {
612
+ nPlotStems (labelID , values , size , yRef , offset );
613
+ }
614
+
546
615
private static native void nPlotStems (String labelID , double [] values , int size , int yRef , int offset ); /*
547
616
ImPlot::PlotStems(labelID, values, size, yRef, offset);
548
617
*/
@@ -568,6 +637,13 @@ public static <T extends Number> void plotVLines(final String labelID, final T[]
568
637
nPlotVLines (labelID , v , v .length , offset );
569
638
}
570
639
640
+ /**
641
+ * Plots infinite vertical lines (e.g. for references or asymptotes).
642
+ */
643
+ public static void plotVLines (final String labelID , final double [] values , final int size , final int offset ) {
644
+ nPlotVLines (labelID , values , size , offset );
645
+ }
646
+
571
647
private static native void nPlotVLines (String labelID , double [] values , int size , int offset ); /*
572
648
ImPlot::PlotVLines(labelID, values, size, offset);
573
649
*/
@@ -593,6 +669,13 @@ public static <T extends Number> void plotHLines(final String labelID, final T[]
593
669
nPlotHLines (labelID , v , v .length , offset );
594
670
}
595
671
672
+ /**
673
+ * Plots infinite horizontal lines (e.g. for references or asymptotes).
674
+ */
675
+ public static void plotHLines (final String labelID , final double [] values , final int size , final int offset ) {
676
+ nPlotHLines (labelID , values , size , offset );
677
+ }
678
+
596
679
private static native void nPlotHLines (String labelID , double [] values , int size , int offset ); /*
597
680
ImPlot::PlotHLines(labelID, values, size, offset);
598
681
*/
@@ -627,6 +710,13 @@ public static <T extends Number> void plotPieChart(final String[] labelIDs, fina
627
710
nPlotPieChart (labelIDsSs , maxSize , v , v .length , x , y , radius );
628
711
}
629
712
713
+ /**
714
+ * Plots a pie chart. If the sum of values {@code >} 1, each value will be normalized. Center and radius are in plot units. #label_fmt can be set to NULL for no labels.
715
+ */
716
+ public static void plotPieChart (final String labelIDsSs , final int strLen , final double [] values , final int size , final double x , final double y , final double radius ) {
717
+ nPlotPieChart (labelIDsSs , strLen , values , size , x , y , radius );
718
+ }
719
+
630
720
//JNI function splits up passed string labelIDsSs to array for use in C++, as String[] is not converted by JNI
631
721
private static native void nPlotPieChart (String labelIDsSs , int strLen , double [] values , int size , double x , double y , double radius ); /*
632
722
char** labelIDs = new char*[size];
@@ -670,6 +760,14 @@ public static <T extends Number> void plotHeatmap(final String labelID, final T[
670
760
nPlotHeatmap (labelID , v , values [0 ].length , values .length );
671
761
}
672
762
763
+ /**
764
+ * Plots a 2D heatmap chart.
765
+ * @param values must have fixed dimensions (all arrays are same length)
766
+ */
767
+ public static void plotHeatmap (final String labelID , final double [] values , final int rows , final int cols ) {
768
+ nPlotHeatmap (labelID , values , rows , cols );
769
+ }
770
+
673
771
private static native void nPlotHeatmap (String labelID , double [] values , int rows , int cols ); /*
674
772
ImPlot::PlotHeatmap(labelID, values, rows, cols);
675
773
*/
@@ -693,6 +791,13 @@ public static <T extends Number> double plotHistogram(final String labelID, fina
693
791
return nPlotHistogram (labelID , v , v .length );
694
792
}
695
793
794
+ /**
795
+ * Plots a horizontal histogram.
796
+ */
797
+ public static double plotHistogram (final String labelID , final double [] values , final int size ) {
798
+ return nPlotHistogram (labelID , values , size );
799
+ }
800
+
696
801
private static native double nPlotHistogram (String labelID , double [] values , int size ); /*
697
802
return ImPlot::PlotHistogram(labelID, values, size);
698
803
*/
@@ -709,6 +814,13 @@ public static <T extends Number> double plotHistogram2D(final String labelID, fi
709
814
return nPlotHistogram2D (labelID , x , y , x .length );
710
815
}
711
816
817
+ /**
818
+ * Plots two dimensional, bivariate histogram as a heatmap.
819
+ */
820
+ public static double plotHistogram2D (final String labelID , final double [] xs , final double [] ys , final int size ) {
821
+ return nPlotHistogram2D (labelID , xs , ys , size );
822
+ }
823
+
712
824
private static native double nPlotHistogram2D (String labelID , double [] xs , double [] ys , int size ); /*
713
825
return ImPlot::PlotHistogram2D(labelID, xs, ys, size);
714
826
*/
@@ -730,6 +842,13 @@ public static <T extends Number> void plotDigital(final String labelID, final T[
730
842
nPlotDigital (labelID , x , y , x .length );
731
843
}
732
844
845
+ /**
846
+ * Plots digital data. Digital plots do not respond to y drag or zoom, and are always referenced to the bottom of the plot.
847
+ */
848
+ public static void plotDigital (final String labelID , final double [] xs , final double [] ys , final int size ) {
849
+ nPlotDigital (labelID , xs , ys , size );
850
+ }
851
+
733
852
private static native void nPlotDigital (String labelID , double [] xs , double [] ys , int size ); /*
734
853
ImPlot::PlotDigital(labelID, xs, ys, size);
735
854
*/
@@ -865,6 +984,14 @@ public static void setNextPlotTicksX(final double xMin, final double xMax, final
865
984
nSetNextPlotTicksX (xMin , xMax , nTicks , labelStrings [0 ], labelStrings [1 ], labelStrings [2 ], labelStrings [3 ], keepDefault );
866
985
}
867
986
987
+ /**
988
+ * This function MUST be called BEFORE beginPlot!
989
+ * Set the X axis ticks and optionally the labels for the next plot. To keep the default ticks, set #keepDefault=true.
990
+ */
991
+ public static void setNextPlotTicksX (final double xMin , final double xMax , final int nTicks , final String s1 , final String s2 , final String s3 , final String s4 , final boolean keepDefault ) {
992
+ nSetNextPlotTicksX (xMin , xMax , nTicks , s1 , s2 , s3 , s4 , keepDefault );
993
+ }
994
+
868
995
private static native void nSetNextPlotTicksX (double xMin , double xMax , int nTicks , String s1 , String s2 , String s3 , String s4 , boolean keepDefault ); /*
869
996
char* strings[] = {s1, s2, s3, s4};
870
997
ImPlot::SetNextPlotTicksX(xMin, xMax, nTicks, strings, keepDefault);
@@ -903,7 +1030,15 @@ public static void setNextPlotTicksY(final double xMin, final double xMax, final
903
1030
nSetNextPlotTicksY (xMin , xMax , nTicks , labelStrings [0 ], labelStrings [1 ], labelStrings [2 ], labelStrings [3 ], keepDefault , yAxis );
904
1031
}
905
1032
906
- public static native void nSetNextPlotTicksY (double xMin , double xMax , int nTicks , String s1 , String s2 , String s3 , String s4 , boolean keepDefault , int yAxis ); /*
1033
+ /**
1034
+ * This function MUST be called BEFORE beginPlot!
1035
+ * Set the Y axis ticks and optionally the labels for the next plot. To keep the default ticks, set #keepDefault=true.
1036
+ */
1037
+ public static void setNextPlotTicksY (final double xMin , final double xMax , final int nTicks , final String s1 , final String s2 , final String s3 , final String s4 , final boolean keepDefault , final int yAxis ) {
1038
+ nSetNextPlotTicksY (xMin , xMax , nTicks , s1 , s2 , s3 , s4 , keepDefault , yAxis );
1039
+ }
1040
+
1041
+ private static native void nSetNextPlotTicksY (double xMin , double xMax , int nTicks , String s1 , String s2 , String s3 , String s4 , boolean keepDefault , int yAxis ); /*
907
1042
char* strings[] = {s1, s2, s3, s4};
908
1043
ImPlot::SetNextPlotTicksY(xMin, xMax, nTicks, strings, keepDefault, yAxis);
909
1044
*/
0 commit comments