2
$\begingroup$

In a previous post, I learned how to take coordinates data in a list and plot lines with arrow ends, thus giving a sense of "direction of movement".

However, the basic solution makes things somewhat unclear. Inspired by the following diagram, I am now interested in learning how to create this look-feel in my diagram. Moreover, I am interested in a further detail. This further detail is as follows.

I wish to draw arrows with different colours depending on four criteria: (x_up,y_up), (x_up, y_down),(x_down,y_up), (x_down, y_down).

I realize that some lines may have unchanging x's and y's, but if I get an idea of how to solve this specific problem, I should be able to solve the general.

For convenience, I am restating the data from the prior post:

data = {{{0.414513, 0.0489003, 0.397241, 0.0357143}, {0.40829, 0.0422302, 0.417166, 0.0365926}, {0.384615, 0.0833333, 0.401338, 0.0826405}, {0.384615, 0.0833333, 0.401338, 0.0826405}, {0.392318, 0.10824, 0.392318, 0.10824}}}

which has the format {x1,y1, x2, y2}

Here is the neat image that I wish to follow (except for the mono-colouring):

enter image description here

$\endgroup$
2
$\begingroup$

Something like:

data = {{{0.414513, 0.0489003, 0.397241, 0.0357143}, {0.40829, 
    0.0422302, 0.417166, 0.0365926}, {0.384615, 0.0833333, 0.401338, 
    0.0826405}, {0.384615, 0.0833333, 0.401338, 0.0826405}, {0.392318,
     0.10824, 0.392318, 0.10824}}};

ar = {Switch[{If[#[[1]] > #[[3]], down, up], 
       If[#[[2]] > #[[4]], down, up]}, {up, up}, Red, {up, down}, 
      Blue, {down, up}, Green, {down, down}, Magenta], 
     Arrow[{#[[1 ;; 2]], #[[3 ;; 4]]}]} & /@ data[[1]];
Graphics[ar]

enter image description here

$\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.