3
$\begingroup$

I use this code

{data1, data2} = Transpose[Table[{2 n, 3 n + 100}, {n, 20}]];
a = ListPlot[{data1, data2}, Joined -> True, 
  PlotStyle -> {Directive[Red, Thickness[Scaled[10^-2]]], 
    Directive[Blue, Thickness[Scaled[10^-2]]]}, Mesh -> All, 
  MeshStyle -> Directive[PointSize[Large], Red],
  ClippingStyle -> False]

and I get this picture

enter image description here

Now, I have two questions:

  1. How can I ask Mathematica to change the color (red to blue) and shape (circle to diamond) of the plotmarker in the upper curve?
  2. How can I remove the joined line for the upper curve?
$\endgroup$
4
$\begingroup$
ListPlot[{data1, data2}, 
 Joined -> {True, False}, 
 PlotStyle -> {Directive[Red, Thickness[Scaled[10^-2]]], Blue},
 PlotMarkers -> {{"●", 12}, {"◆", 12}}]

enter image description here

$\endgroup$
2
$\begingroup$

Like this?

{data1, data2} = Transpose[Table[{2 n, 3 n + 100}, {n, 20}]];
a = ListPlot[data1, Joined -> True, 
   PlotStyle -> {Directive[Red, Thickness[Scaled[10^-2]]], 
     Directive[Blue, Thickness[Scaled[10^-2]]]}, Mesh -> All, 
   MeshStyle -> Directive[PointSize[Large], Red], 
   ClippingStyle -> False];
b = ListPlot[data2, Mesh -> 20, PlotStyle -> All, 
   ColorFunction -> Function[{x, y}, Blend[{Red, Blue}, x]]];
Show[a, b, PlotRange -> All]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks. I wanted the upper points to only be pure blue and change their shape to diamond. $\endgroup$ – charmin Dec 5 '20 at 0:18
  • $\begingroup$ @charmin Sorry, I misunderstanding " red to blue" $\endgroup$ – cvgmt Dec 5 '20 at 0:47
  • $\begingroup$ Thanks, it was my bad in writing. $\endgroup$ – charmin Dec 5 '20 at 18:53

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.