0
$\begingroup$

Both of my questions concern ListPlot, so I hope it is acceptable to ask them both in one post.

  1. ErrorListPlot seems to have been suspended as of version 12, is there a built-in alternative for creating scatter plots with errorbars?

  2. For creating scatter plots with double-Y axes (and shared x-axis), is there a functionality to create a twin-axis (similar to twinx in Python)? I have tried using Overlay[{plot1,plot2}] as a workaround but it creates two slightly shifted plots instead of creating a y-axis opposite side of the original one. Any practical hints for how to create double-Y plots would be very helpful.

$\endgroup$
4
  • 2
    $\begingroup$ RE: ErrorListPlot - this has been superseded by using Around. $\endgroup$
    – rcollyer
    Aug 7, 2019 at 13:02
  • $\begingroup$ You are saying it yourself, the documentation clearly indicates "As of Version 12, ErrorListPlot has been superseded by ListPlot.". Use ListPlot[{Around[1, .1], Around[2, .2], Around[3, .3]}] $\endgroup$
    – rhermans
    Aug 7, 2019 at 13:02
  • $\begingroup$ How is it awkward? It should be fairly trivial to convert any list of points into the Around notation. $\endgroup$
    – ktm
    Aug 7, 2019 at 13:09
  • 1
    $\begingroup$ In the future please ask one question at the time. $\endgroup$
    – rhermans
    Aug 7, 2019 at 13:25

1 Answer 1

4
$\begingroup$

ErrorListPlot

What you achieved before with ErrorListPlot now can be achieved with ListPlotand Around

data = Table[{i, RandomReal[0.5]}, {i, 10}]
ErrorListPlot[data]

ListPlot[
 Apply[
  Around
  , data
  , {1}
  ]
]

enter image description here

From the example in the documentation for Around

rmdata = DeleteMissing[
   ExoplanetData[
    EntityClass["Exoplanet", All],
    {"MassAround", "RadiusAround"}
    ]
   , 1
   , 1
   ];

ListPlot[
 rmdata
 , Frame -> True
 , FrameLabel -> {"mass (kg)", "radius (m)"}
 , ScalingFunctions -> {"Log", None}
 , PlotRange -> {{10^25, Automatic}, Automatic}
 , PlotMarkers -> {Automatic, 5}
 , IntervalMarkersStyle -> LightGray
 , ImageSize -> 500
 ]

enter image description here

double-Y axes

That already has an answers here:

$\endgroup$
2
  • 1
    $\begingroup$ Might be worth linking to this question as well for an example of how to combine general plots (as far as I can tell, the others are mostly specialized to a specific plot type) $\endgroup$
    – Lukas Lang
    Aug 7, 2019 at 14:36
  • $\begingroup$ @user929304 did you read the documentation for Around that I linked? Try {Around[1, 0.1], Around[2, 0.1]}. If you really need more help after reading the documentation, you should ask another question.Read this $\endgroup$
    – rhermans
    Aug 8, 2019 at 9:00