1
$\begingroup$

I have to plot a list plot with the double y-axis; range y1 = {0, 125} and range y2 = {100, 900}. I have to use markers for the points in the plot. I have used the following code to create markers for the plots

markers1={Graphics[Disk[],ImageSize->8],Graphics[Rectangle[],ImageSize->8],Graphics[Simplex[{{0,0},{1,1},{2,0}}],ImageSize->12]};
markers2={Graphics[Disk[],ImageSize->20],Graphics[Rectangle[],ImageSize->20],Graphics[Simplex[{{0,0},{1,2},{2,0}}],ImageSize->22]};

I have used ResourceFunction["CombinePlots"] to combine the plots.

But the markers in the second y-axis plot is getting compressed. The picture is attached. How can make all the markers same? enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Please post all your code and data. It is hard to answer this given just the plot markers. $\endgroup$
    – Conor
    Feb 11, 2021 at 19:04

2 Answers 2

1
$\begingroup$

One option is to use Offset-type coordinates for your plot markers (see also this question):

markers = {
   Graphics[Disk[{0, 0}, Offset@5], ImageSize -> 20], Graphics[Rectangle[Offset[{-5, -5}], Offset[{5, 5}]], ImageSize -> 20], Graphics[Simplex[Offset /@ {{-5, -5}, {0, 5}, {5, -5}}], ImageSize -> 22]
   };

SeedRandom[2];
ResourceFunction["CombinePlots"][
 ListLinePlot[RandomInteger[{0, 10}, {3, 5}], PlotMarkers -> markers, Frame -> True],
 ListLinePlot[RandomInteger[{0, 100}, {3, 5}], PlotMarkers -> markers, Frame -> True, PlotStyle -> Dashed],
 "AxesSides" -> "TwoY"
 ]

enter image description here

(Note also that I have made sure the markers are centered around {0,0} to make sure they are properly aligned, see AlignmentPoint for more details)

$\endgroup$
0
$\begingroup$

I have solved the above problem. You can change the shape of the circle and rectangle in the marker2 to fit the compression. Here is the code.

     markers2={Graphics[Disk[{0,0},{1.5,10}],ImageSize->8],Graphics[Rectangle[{0,0},{1,5}],ImageSize->8],Graphics[Simplex[{{0,0},{1,10},{2,0}}],ImageSize->12]};
$\endgroup$

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.