# 3D Graph example

## Recommended Posts

Can anyone share a good example of the 3D graph component? I tried putting some example arrays into the Expression field just to get started, but the graph component remains completely blank. None of the options seem to have any effect either.

```{1,2,3,4} // 1D array
{{1,2},{3,4}} // 2D array
{{{1,2},{3,4}},{{5,6},{7,8}}} // 3D array
{{{1,2,10,20},{3,4,11,21}},{{5,6,12,22},{7,8,13,23}}} // another 3D
{{{1,2},{3,4},{10,11},{15,16}},{{5,6},{7,8},{12,13},{17,18}}} // and another```

I'm looking to scatter plot scalar data (vertical axis) vs. lat/long coordinates (horizontal plane). My data is in separate channels right now. My DF version is 18.1 build 2347

##### Share on other sites

I believe there is an issue with the 3d graph under the 17/18 releases.  Email us directly and I believe we have a patch.

That said, I would consider using a regular 2D graph of your lat/long position where you use the multicolor feature of the trace for the 3rd axis.  This is usually much easier to interpret than a 3d graph.

##### Share on other sites

• 2 weeks later...

OK thanks - I'll wait for the patch and try again with 3D later. I'd like it for experimenting with plotting multiple variables. For now I have a single variable plotted 2D and works pretty OK. There's two big challenges I encountered and could use advice on.

The first is the color selector: it's made of discrete thresholds (versus, for example, assigning a gradient to span a range set by two values). We want to adjust color scales quickly as ambient conditions change or we swap in different variables of interest. The best approach I found was to assign thresholds from 0 to 1 and then normalize the plotted variable by the desired maximum range value. It's clunky but faster than editing thresholds. Perhaps there's a better approach?

My other challenge is to underlay a static image from Google Earth. I might try it as a screen component underneath the plot at first. Ideally though the lat/long (x/y) ranges chosen for the 2D plot would be used to align the image. Not sure that's possible with a 2D graph though.

##### Share on other sites

1) two things you can do: a) you can normalize as you described, but do it in the color expression rather than actually changing the data, or b) you have script access to the color table.  Name the trace, then it is basically component.myGraph.myTrace.addColor() and .clearColors().  It is described in 8.13 of the user's guide.  Note that you have to clear and rebuild the table each time, but it is fast.

2) graphs aren't transparent so this won't work.  I know that the NOAA Aeronomy lab (known as something else now) managed to get x/y coordinates for the outline of a map for the area they were flying and simply had the graph plot this as well.  Then it would zoom everything together.

##### Share on other sites

Agreed, I do the normalization in the color expression and have a global variable that defines the normalized range maximum. Having script access to the color table builder will make this approach much more efficient and doable - thanks for the heads up.

Could I use an Image component instead of 2D graph? Plotting line features on a 2D graph is straightforward if the data is well-formatted, but transforming GIS data into that format is not trivial. I am more interested in placing satellite imagery underneath anyway, versus showing line features.

##### Share on other sites

I'm not sure then what you are trying to do.

##### Share on other sites

I can emulate this plot using 2D graph component. Would be nice to have the color scale legend but it doesn't seem to have an option for display.

[output_38_1.png]

I'd like to underlay a map image like in this plot. If 2D graph were transparent I would just paste a screenshot. The User Guide says Image will handle 2D data but I tried and saw the data should actually be a 3D array. So I'm not sure if this is actually possible in DF.

[output_40_1.png]

Just example images, btw. The data I want to plot would be contained in a relatively small area, less than a square mile, hence the desire for satellite imagery views.

##### Share on other sites

What does the data look like (lat/long/value?) and how many data points are you planning on plotting?

##### Share on other sites

The data is separate channels right now:

* Latitude
* Longitude
* Some environmental scalar (e.g. gas concentration or temperature)

I anticipate 1Hz sampling so if we plot the most recent half-hour (typical) it'd be 1800 rows.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.