You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/user_docs/docs/manual/Plotting.rst
+25-6Lines changed: 25 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -615,12 +615,31 @@ e.g. following a spin wave dispersion ring/cone as a function of energy.
615
615
Miscellaneous functions
616
616
=======================
617
617
618
-
``meta(fig)`` allows you to copy the figure into a metafile. On Windows, this
619
-
function puts the file in the clipboard so that it can be pasted directly into
620
-
Word, Powerpoint etc.
618
+
* ``meta(fig)`` allows you to copy the figure into a metafile.
619
+
On Windows, this function puts the file in the clipboard so that it can be pasted directly into
620
+
Word, Powerpoint etc.
621
621
622
-
``genieplot`` is a singleton, which describes common settings (configuration) used in Horace plots.
622
+
* ``genieplot`` is a singleton, which describes common settings (configuration) used in Horace plots.
623
623
624
-
``genieplot.instance()`` gives one access to the settings, similar to one, used for changing properties of MATLAB ``figure`` classes.
624
+
* ``genieplot.instance()`` gives access to the settings common to all Horace figures.
625
+
The result behaves similarly to the properties of MATLAB ``figure`` classes, but is applied for all
626
+
figures plotted after the change.
625
627
626
-
See :ref:`geneplot_settings` to get more details about Horace graphics configurations.
628
+
See :ref:`geneplot_settings` to get more details about Horace graphics configurations.
629
+
630
+
* ``src(fig)``. If you plotted an object and want to return the object, used as the source of the figure,
631
+
you may use ``src`` command:
632
+
633
+
::
634
+
635
+
>>source = src(fig);
636
+
or
637
+
>>source = src(figure_number);
638
+
639
+
This command returns you the Horace object (``sqw``, ``dnd`` or ``IX_dataset_nD``) used as the source of the plot. The option to store references to plotted objects in figure
640
+
handles is configured by :ref:`Horace Configuration Settings <hor_config_settings>` property
641
+
``store_src_in_plots``. If your machine has very limited memory, you may want set this property to ``false`` so this option becomes unavailable and you may delete your resulting
642
+
objects immediately after they were plotted. By default, reference to plotted Horace object is stored in figure handle's ``UserData`` property, so the source object exist until its figure exists. ``src`` command finds appropriate figure handle and returns contents of ``UserData`` property.
643
+
644
+
* ``draw_mask``. The algorithm allows you to define mask by drawing it on plotted image if image processing toolbox is installed.
645
+
See :ref:`draw_mask_algorithm` for more details about this routine.
* ``fig_num`` -- number of existing figure to draw mask on **or**
415
+
* ``fig_ax_handle`` -- handle to the image(``gcf`` for current) or the axis (``gca`` for current) to draw mask on.
416
+
417
+
Optional:
418
+
419
+
* ``'mask_vertices'`` -- key followed by 2-dimensional array of coordinates, defining points surrounding area to mask.
420
+
**Mandatory** if you do not have image processing toolbox installed.
421
+
* ``'-keep_area'`` -- If option provided, area surrounded by input points is kept and external area is masked. By default,
422
+
mask excludes selected part of the image.
423
+
* ``'-freehand_draw'`` -- use MATLAB "drawfreehand" routine to draw mask on the image provided. If this key is not provided,
424
+
routine uses MATLAB's "drawpolygon" routine to draw the mask. Option is ignored if ``fig_info`` is Horace
425
+
dataset and ``mask_vertices`` are provided. Drawing options are available only if image processing toolbox is installed.
426
+
427
+
Returns:
428
+
429
+
* ``msk`` logical array with dimensions of masked image i.e. ``size(win.data.npix)`` or ``win.data.img_size`` if input ``win`` object
430
+
is an ``sqw`` object. Object contains ``true`` for cells to keep and ``false`` for masked areas.
431
+
432
+
Additional returns:
433
+
434
+
* ``ax`` -- the axes handle for the image to mask.
435
+
* ``mask_vertices`` -- the vertices which define mask. Output ``mask_vertices`` coincide with input mask vertices
436
+
if you provided them, or are the coordinates of the points drawn on the image in image coordinate system if they were drawn. (needs image processing toolbox).
437
+
438
+
439
+
The figure below shows the result of executing the following code:
440
+
441
+
.. code-block:: matlab
442
+
443
+
msk = draw_mask(6);
444
+
wout = mask(src(6),msk);
445
+
plot(wout); lz 0 0.5;
446
+
447
+
where image number 6 was present in Matlab workspace. If image processing toolbox is available, one can draw the points
448
+
highlighted by red arrow on the left part of the image using mouse, but if toolbox is not available one needs to
449
+
read the coordinates of these points from the image and provide them as 2x6 array of image coordinates values
0 commit comments