Group Abstract Group Abstract

Message Boards Message Boards

0
|
13.3K Views
|
7 Replies
|
0 Total Likes
View groups...
Share
Share this post:

ListPlot and empty lists?

Posted 11 years ago
POSTED BY: David Keith
7 Replies
Posted 6 years ago

I am having this exact issue as well, in 11.3, but with ListPointPlot3D. I found the replacement rules with Missing[] or \[EmptySet] got rid of the errors, but didn't actually make the plot. I ended up instead replacing the empty lists with a single point at the origin, and then adding an If statement to PlotStyle to assign None if the length was zero., which preserved the structure of the Legend

POSTED BY: Evan Johnson
Posted 11 years ago

Thank to both of you. Works great.

Marco -- Interesting concept: the structure of the empty set. Maybe related to 1==={ {} }, 2==={ {},{} } . . . . ;-)

POSTED BY: David Keith

When I have had to deal with this issue I have generally replaced the empty list by a list with a single element with the value Missing[]. In the case of DateListPlot, I use an arbitrary date with its corresponding value as Missing[]. E.g.

ListPlot[{d, {Missing[]}}]
POSTED BY: David Reiss
POSTED BY: Marco Thiel
Posted 11 years ago

I thought I would try the same solution with DateListPlot, but it doesn't like the empty set.

POSTED BY: David Keith
Posted 11 years ago
POSTED BY: David Keith

Hi,

I have no really nice way of doing what you want to achieve, but I noticed that:

ListPlot[{d, {\[EmptySet]}}]

plots fine. And so does

ListPlot[{d, {_, _}}]

I guess that this command

ListPlot[{d, {{}}} /. {{}} -> {\[EmptySet]}]

could be useful. If you do that Mathematica does draw legends:

ListPlot[{d, {\[EmptySet]}}, PlotLegends -> Automatic]

enter image description here

Unfortunately, I do not really understand what you mean by "I can't just strip out the empty lists, since their identity is important and corresponds to a legend.", and therefore am not sure whether this is useful at all.

Cheers,

Marco

POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard