Plotting grouped scatter plot with different markers from a text wave

Hi,

I have three waves. Wave0 and wave 1 are numerics and wave 2 is text wave. I am trying to create a scatter plot (x=wave0, y=wave1) automatically grouped with different markers (ex: g1, g2, g3). For grouping, I’d like to use a text wave which contains g1, g2, g3 and corresponds to x and y waves. 

Any suggestion would be welcomed.

 

 

I'd use a numeric wave containing the marker type (MT):

make /N=10 wX =gnoise(2), wY =gnoise(2), MT
make /T/N=10 GL={"G2","G1","G3","G3","G2","G1","G1","G3","G2","G1","G2"}
display wY vs wX

ModifyGraph mode=3, zmrkNum(wy)={MT}
MT = stringmatch(GL,"G1") ? 1 : MT
MT = stringmatch(GL,"G2") ? 16 : MT
MT = stringmatch(GL,"G3") ? 7 : MT

TextBox/C/N=text0/A=RT/X=0.00/Y=0.00 "\\W516 G1\r\\W507 G2\r\\W501 G3"

HJ

But you can also use the text wave that has "G1", "G2", "G3" as the source for text markers:

Window Graph0() : Graph
    PauseUpdate; Silent 1       // building window...
    Display /W=(244,463,639,671) wY vs wX
    ModifyGraph mode=3
    ModifyGraph rgb=(0,0,0)
    ModifyGraph msize=4
    ModifyGraph textMarker(wY)={GL,"default",0,0,5,0.00,0.00}
EndMacro

Note that HJDrescher accidentally made his text wave with 11 elements. The contents of the braces (GL={...}) overrides the /N= flag.

Graph0.png (13.3 KB)

That could be done by text markers and using escape sequences.

make /N=10 wX =gnoise(2), wY =gnoise(2)
make /T/N=10 GL={"G2","G1","G3","G3","G2","G1","G3","G2","G1","G2"}
display wY vs wX
ModifyGraph mode=3
Make /T/N=10 MS // MarkerStyle
MS=selectstring(!stringmatch(GL[p],"G1"), "\K(0,65280,0)\k(0,0,0)\W516", MS[p])
MS=selectstring(!stringmatch(GL[p],"G2"), "\K(0,0,65280)\k(0,0,65280)\W515", MS[p])
MS=selectstring(!stringmatch(GL[p],"G3"), "\K(65280,0,0)\k(65280,0,0)\W501", MS[p])
ModifyGraph textMarker(wY)={MS,"default",0,0,5,0.00,0.00}

However, this is getting a little ugly. Maybe you want to reconsider the data structure and store one set of data in one xy wave-pair (or an Nx2 wave).

HJ

In reply to by greenriver

It seems like that is what HJDrescher showed you originally. The easiest way to pick a marker is via a numeric wave containing marker numbers, and selecting that marker wave in the Modify Trace Appearance dialog as the Marker as f(z) wave. The code HJDrescher gave you was an easy way to build the marker wave.

Hi,

 

I run into this need quite a bit.  Basically numeric waves with data and text waves with labels.  Some other programs handle this as a course of business easily.

I cobbled together a simple tool that helps create the marker wave for customization.

 

Attached without warranty.

 

Andy

XY Marker Maker.pxp (173.1 KB) XY Marker Maker.png (321.74 KB)

Hi,

 

Updated my tool.  You can now both a marker wave based on a text wave, or extract subsets of waves based on a key text wave.

The extraction looks for unique names in the text wave and then extracts each subset appending that label to end of the base wave name.

I have been meaning to write this for my own use.  Feedback is most welcome.

Andy

XY Marker Maker v2.pxp (177.78 KB)