4
$\begingroup$

Consider the following list

list = {{1,1,1},{1,2,1},{1,3,2},{1,4,2},
        {2,1,1},{2,2,2},{2,3,2},{2,4,2},
        {3,1,1},{3,2,2},{3,3,3},{3,4,3},
        {4,1,2},{4,2,3},{4,3,3},{4,4,3}};

The list is composed of sublists in the form of {x,y,value}, where the first and second element are the coordinates, and the third element is a value which should be assigned in the phase diagram.

In the example above, I would a different color to be assigned to a different number (say 1 - blue, 2 - red, 3 - green).

The result should look like the following

enter image description here

This is a simplified example of a much larger data set, with very small spacings between the {x,y} values, which should eventually produce several colors that represent phases.

$\endgroup$
  • 2
    $\begingroup$ Why do you call this a "phase plot"? $\endgroup$ – David G. Stork Mar 26 at 20:10
  • $\begingroup$ @Stork, changed to phase diagram, if u know a better terminology please edit. $\endgroup$ – jarhead Mar 27 at 7:13
9
$\begingroup$

E.g.

Graphics[{{Blue, Red, Green}[[#3]], Disk[{#2, #}, 1/3]} & @@@ list,
 AxesOrigin -> {1, 1}/2, FrameStyle -> FontSize -> 28,
 FrameTicks -> {Range[4], Range[4], None, None}, Frame -> True,
 FrameLabel -> {Style["Y", 24], Rotate[Style["X", 24], -90 °]}]

$\endgroup$
  • 2
    $\begingroup$ Perhaps it is personal preference, but would it be better practice to use the option RotateLabel -> False rather than rotate the "X" label manually? $\endgroup$ – lastresort Mar 27 at 2:23
3
$\begingroup$

This approach might appeal

BubbleChart[list /. {x_, y_, z_} -> {y, x, z}, 
 BubbleSizes -> {0.25, 0.25}, 
 ColorFunction -> 
  Function[{x, y, r}, 
   Switch[{x, y, r}, {_, _, 1}, Blue, {_, _, 2}, Red, {_, _, 3}, 
    Green]], ColorFunctionScaling -> False, 
 FrameTicks -> {Range[4], Range[4], None, None}, Frame -> True, 
 FrameLabel -> {"Y", "X"}, RotateLabel -> False]

enter image description here

You can adjust the space between bubbles by changing the BubbleSizes.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.