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$

1 Answer 1

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$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.