0
$\begingroup$

I have a data as:

data = {{0.1, 3}, {0.1, -2}, {0.1, -1}, {0.1, 4}, {0.1,5}, {0.2, -2}, {0.2, -7}, {0.2, -4}, {0.2, 3}, {0.2,3}, {0.3, -8}, {0.3, 4}, {0.3, 2}, {0.3, 1}, {0.3, 2}};

I want to use of plot markers (in which have been defined some markers), for plotting my data. But unfortunately because, my data is not arranged as defined in plot markers I could not access to my goal. I want to have a plot with a specified similar symbol (and specified similar color) for the lowest value of second quantity in pair: {0.1, -2},{0.2,-7},{0.3,-8} and for the second lowest values: another specified symbol and color (but similar):{0.1,-1},{0.2,-4},{0.3,1}. Although I know a one way is rearrange the data to a new arrangement saving suitable form to plot it but since there is a repeating element same as {0.3,2}(as it repeats two times) I could not able to plot desire situation.

$\endgroup$

1 Answer 1

2
$\begingroup$

We first define a sorted data set via

dataSort = Partition[SortBy[data, {First, Last}], 5] // Transpose;

The SortBy first sorts by the first element of each list (which is already done), and then within this sort sorts by the second element of each list. This fixes the fact that the two {0.3, 2} lists are not next to each other in the list, and it makes it so that when we Partition the list by the number of x-values, we line things up correctly. Note that this method will only work if there are the same number of points for each x-value.

We plot it as

ListLinePlot[dataT, PlotMarkers -> {Automatic, 12}, Frame -> True, Axes -> False]

resulting in

enter image description here

$\endgroup$
1
  • $\begingroup$ Yes, thanks, your answer is exact I was finding $\endgroup$ Commented Sep 11, 2015 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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