Opened 10 years ago

Closed 10 years ago

# log plots blank with points, but fine with lines

Reported by: Owned by: jason jason, was major sage-duplicate/invalid/wontfix graphics kcrisman, ppurka, Punarbasu Purkayastha N/A

### Description

Inspired by http://ask.sagemath.org/question/1743/list_plot_semilogy-not-working, look at this. The following three plots are all blank (and the log axes also seem blank)

```import mpmath
ber = [0.5*mpmath.erfc(i)/sqrt(2) for i in range(10)]
points(enumerate(ber)).show(scale='semilogx')
points(enumerate(ber)).show(scale='semilogy')
points(enumerate(ber)).show(scale='loglog')
```

while the following (obtained by changing `points` to `line`) seem to work fine.

```import mpmath
ber = [0.5*mpmath.erfc(i)/sqrt(2) for i in range(10)]
line(enumerate(ber)).show(scale='semilogx')
line(enumerate(ber)).show(scale='semilogy')
line(enumerate(ber)).show(scale='loglog')
```

### comment:1 Changed 10 years ago by ppurka

The problem seems more generic. This works:

```sage: list_plot_semilogy([10^-i for i in range(3)])
```

This doesn't work:

```sage: list_plot_semilogy([10^-i for i in range(4)])
```

So, the bug might be in points itself, or in matplotlib.

### comment:2 Changed 10 years ago by ppurka

About the second plot in comment:1 - this is fixed on adding #13528. Don't ask me why. `^_^`

About the original question, the problem with the plot is that the point `x=0` is present in the plot. This is a documented fail situation - look at the doc `list_plot?` or `point2d?`, both of which mention that non-positive points should not be used in the log scale. This is the reason why `point` works with `semilogy` scale and not with `semilogx` or `loglog`.

```sage: points(zip(*(range(1,len(ber)+1), ber))).show(scale='loglog')
sage: points(zip(*(range(1,len(ber)+1), ber))).show(scale='semilogx')
```

If you want to use the `x=0` point, then use `list_plot` along with `plotjoined=True, linestyle='', marker='o'`:

```sage: list_plot(list(enumerate(ber)), plotjoined=True, linestyle='', marker='o').show(scale='semilogx')
sage: list_plot(list(enumerate(ber)), plotjoined=True, linestyle='', marker='o').show(scale='semilogy')
sage: list_plot(list(enumerate(ber)), plotjoined=True, linestyle='', marker='o').show(scale='loglog')
```

This latter command runs through the `line` command in Sage, which uses the usual `plot` of matplotlib. `plotjoined=False` runs through the `point` command of Sage, which uses the `scatter` command of matplotlib. So, the failure of `x=0` in log scale is from the scatter command in matplotlib.

### comment:3 Changed 10 years ago by ppurka

Milestone: sage-5.7 → sage-duplicate/invalid/wontfix new → needs_review

Works for me (TM)

### comment:4 Changed 10 years ago by ppurka

Status: needs_review → positive_review

### comment:5 Changed 10 years ago by jdemeyer

Resolution: → worksforme → Punarbasu Purkayastha positive_review → closed
Note: See TracTickets for help on using tickets.