Skip to content

get_graph_data.m

Basic Information

  SYNTAX:  get_graph_data(gObj, contoursJustLevels)

  PURPOSE:
    Exteract the data from a chart object in a figure.

  INPUTS:
       gObj:    A chart object (like a line or surface) on a figure
                to extract the data from. See restrictions below for
                supported figure types.

       contoursJustLevels:  (default=1) Option to just extract contour
                            traces at the levels displayed in a
                            figure, as opposed to all included data in
                            the underlying matrix from which contours
                            are displayed.
                            For example: if an EFIT flux grid is in
                            the figure, setting to 0 will include the
                            entire flux grid in the output structure.
                            Setting to 1 will just include the
                            contours of flux displayed in the figure
                            itself.

  OUTPUTS:
       ier:            0 if no failures to extract data, 1 if there
                       was a problem (like the plot type is not
                       supported, for example).

       DisplayName:    The DisplayName of the chart object, if it was
                       defined (usually defined by calling legend()).

       Type:           The object type

       XData:          The XData from the plotting object. If a polar
                       plot, this corresponds to RData. If a lat-lot
                       type plot, this corresponds to LongitudeData.

       YData:          The YData from the plotting object. If a polar
                       plot, this corresponds to ThetaData. If a lat-lot
                       type plot, this corresponds to LattitudeData.

       ZData:          The ZData from the plotting object, if it
                       exists for this type of plot object.

       XNegativeDelta:  For error-bars, the nagative X delta.

       XPositiveDelta: For error-bars, the positive X delta.

       YNegativeDelta: For error-bars, the nagative Y delta.

       YPositiveDelta: For error-bars, the positive Y delta.

       CData:          For surface plots the color can be set to be
                       data dependent, so it is stored if the user set
                       the color to vary with the data. Exception: if
                       the user set the color to just vary with the
                       Z-data, then don't repeat this by just storing
                       it again.

  RESTRICTIONS:
       Currently supported chart objects:
           -Area
           -Bar
           -Contour*
           -ErrorBar
           -Histogram/Histogram2: XData is BinEdges, YData is Values
           -Line
           -Scatter
           -Stair
           -Stem
           -Surface**: only type with CData & CDataMode

           * Contour plots only return data of displayed contours!
               (unless option "contoursFullData" is applied!)

           ** Only returns color data if CData & CDataMode are defined
              and CDataMode is set to 'manual'
              (aka user supplied data, not just a repeat of ZData)
              (future add option to force color?)

           *** If polar axes: XData contains RData values, YData
               contains ThetaData values.

           *** If lat/lon axes: XData contains LongitudeData values,
               YData contains LatitudeData values.

           **** Does NOT return symbol size or alpha data!

       Currently DOES NOT SUPPORT:
           -GeographicBubbleChart
           -Heatmap
           -Quiver
           -StackedAxes
           -StackedLineChart
           -WordCloudChart

  WRITTEN BY:  Jayson Barr ON 10/11/18

  MODIFICATION HISTORY:

Dependencies