Mathematica Asked on March 31, 2021
I’m using Mathematica 12.1.1.0.
When I enter
ListPlot[{{{1500, 4}, {1510, 4}, {1520, 4}, {1850, 6}}, {{1500,
1}, {18100, 1}}}, PlotLabels -> {"a", "b"}, Joined -> True,
PlotRange -> Full]
I get
Part::partw: Part 1 of {} does not exist.
Callout::copos: {19382.2,0.733053} is not a valid position for the placement of callouts.
What’s going on here? How do I avoid getting these error messages?
Edit: I’ve also emailed Wolfram Support about this, with ID [CASE:4760915]. I’ll post any updates they give. I’m still interested in a workaround.
As a workaround
$Version
"12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)"
data = {{{1500, 4}, {1510, 4}, {1520, 4}, {1850, 6}}, {{1500, 1}, {18100, 1}}};
labels = {"a", "b"};
Show[
ListPlot[#[[1]],
PlotStyle -> ColorData[97][#[[2]]],
PlotLabels -> #[[3]],
Joined -> True] & /@
Transpose[{data, Range[Length[data]], labels}],
PlotRange -> All,
AxesOrigin -> {0, 0}]
Alternatively,
Show[
ListPlot[#1,
PlotStyle -> ColorData[97][#2],
PlotLabels -> #3,
Joined -> True] & @@@
Transpose[{data, Range[Length[data]], labels}],
PlotRange -> All,
AxesOrigin -> {0, 0}]
Correct answer by Bob Hanlon on March 31, 2021
I am using V12.1.1.0 on MacOS 10.13.4 and I can reproduces your problem. I found the following work-around:
ListPlot[
{Callout[
{{1500, 4}, {1510, 4}, {1520, 4}, {1850, 6}},
"a", {{2500, 6}, {0, .5}}, {2100, 6}],
Callout[{{1500, 1}, {18100, 1}}, "b"]},
Joined -> True, PlotRange -> All]
The work-around requires giving up the easy-to-use PlotLabels
option and placing a callout wrapper around the 1st dataset, so the excellent micromanaging capabilities provided by Callout
can be used.
Answered by m_goldberg on March 31, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP