@@ -690,9 +690,8 @@ process calling gnuplotlib.
690
690
691
691
- set/unset
692
692
693
- These take either a string or a list. If given a string, a set or unset gnuplot
694
- command is executed with that argument. If given a list, elements of that list
695
- are set/unset separately. Example:
693
+ Either a string or a list/tuple; if given a list/tuple, each element is used in
694
+ separate set/unset command. Example:
696
695
697
696
#+BEGIN_SRC python
698
697
plot(..., set='grid', unset=['xtics', 'ytics])
@@ -704,9 +703,9 @@ instead of the normal behavior of a subplot option overriding the process option
704
703
705
704
- cmds
706
705
707
- Arbitrary extra commands to pass to gnuplot before the plots are created. These
708
- are passed directly to gnuplot, without any validation. The value is either a
709
- string or a list of strings, one per command
706
+ Either a string or a list/tuple; if given a list/tuple, each element is used in
707
+ separate command. Arbitrary extra commands to pass to gnuplot before the plots
708
+ are created. These are passed directly to gnuplot, without any validation.
710
709
711
710
This is both a process and a subplot option. If both are given, BOTH are used,
712
711
instead of the normal behavior of a subplot option overriding the process option
@@ -775,9 +774,8 @@ so '_3d' is accepted for that purpose. Same issue exists with with/_with
775
774
776
775
- set/unset
777
776
778
- These take either a string or a list. If given a string, a set or unset gnuplot
779
- command is executed with that argument. If given a list, elements of that list
780
- are set/unset separately. Example:
777
+ Either a string or a list/tuple; if given a list/tuple, each element is used in
778
+ separate set/unset command. Example:
781
779
782
780
#+BEGIN_SRC python
783
781
plot(..., set='grid', unset=['xtics', 'ytics])
@@ -789,9 +787,9 @@ instead of the normal behavior of a subplot option overriding the process option
789
787
790
788
- cmds
791
789
792
- Arbitrary extra commands to pass to gnuplot before the plots are created. These
793
- are passed directly to gnuplot, without any validation. The value is either a
794
- string or a list of strings, one per command
790
+ Either a string or a list/tuple; if given a list/tuple, each element is used in
791
+ separate command. Arbitrary extra commands to pass to gnuplot before the plots
792
+ are created. These are passed directly to gnuplot, without any validation.
795
793
796
794
This is both a process and a subplot option. If both are given, BOTH are used,
797
795
instead of the normal behavior of a subplot option overriding the process option
@@ -847,9 +845,9 @@ options), then it is up to the user to flip the axis, if that's what they want.
847
845
848
846
- equation, equation_above, equation_below
849
847
850
- These options allows equations represented as formula strings to be plotted
851
- along with data passed in as numpy arrays . These can be a string (for a single
852
- equation) or an array/tuple of strings (for multiple equations) . See the
848
+ Either a string or a list/tuple; if given a list/tuple, each element is used in
849
+ separate equation to plot . These options allows equations represented as formula
850
+ strings to be plotted along with data passed in as numpy arrays . See the
853
851
"Symbolic equations" section above.
854
852
855
853
By default, the equations are plotted BEFORE other data, so the data plotted
@@ -1335,6 +1333,46 @@ This applies to the global gnuplotlib object.
1335
1333
It's not at all trivial to detect if a current plot window exists. If not,
1336
1334
this function will end up waiting forever, and the user will need to Ctrl-C
1337
1335
1336
+ ** add_plot_option()
1337
+ Ingests new key/value pairs into an option dict
1338
+
1339
+ SYNOPSIS
1340
+
1341
+ #+BEGIN_SRC python
1342
+ # A baseline plot_options dict was given to us. We want to make the
1343
+ # plot, but make sure to omit the legend key
1344
+
1345
+ add_plot_option(plot_options, 'unset', 'key')
1346
+
1347
+ gp.plot(..., **plot_options)
1348
+ #+END_SRC
1349
+
1350
+ DESCRIPTION
1351
+
1352
+ Given a plot_options dict we can easily add a new option with
1353
+
1354
+ #+BEGIN_SRC python
1355
+ plot_options[key] = value
1356
+ #+END_SRC
1357
+
1358
+ This has several potential problems:
1359
+
1360
+ - If an option for this key already exists, the above will overwrite the old
1361
+ value instead of adding a NEW option
1362
+
1363
+ - All options may take a leading _ to avoid conflicting with Python reserved
1364
+ words (set, _set for instance). The above may unwittingly create a
1365
+ duplicate
1366
+
1367
+ - Some plot options support multiple values, which the simple call ignores
1368
+ completely
1369
+
1370
+ THIS function takes care of the _ in keys. And this function knows which
1371
+ keys support multiple values. If a duplicate is given, it will either raise
1372
+ an exception, or append to the existing list, as appropriate.
1373
+
1374
+ Multiple values can be given in one call.
1375
+
1338
1376
* COMPATIBILITY
1339
1377
1340
1378
Python 2 and Python 3 should both be supported. Please report a bug if either
0 commit comments