matplotlib / matplotlib/matplotlib

Why matplotlib.pyplot showed the big spaces for hidden data?

Open
#5,483 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

keep
Dominant language
Python
Stars
23.2k
Forks
8.5k
Avg merge
1d 6h
Merged PRs (30d)
66

Description

Hello.

The issue discussed in:
http://stackoverflow.com/questions/33706477/why-matplotlib-pyplot-showed-the-big-spaces-for-hidden-data

Briefly:
The code shows not all lines:

```
import numpy as np
import matplotlib.pyplot as plt
plt.figure()
rand_len = np.random.rand(500)
rand_space = np.random.rand(500)
last_pos = 0.0
for i in range(len(rand_len)):
plt.plot([last_pos, last_pos + 10*rand_len[i]], [1,1],'k-',linewidth=3.0)
last_pos += 10*rand_len[i] + 1000*rand_space[i]
plt.grid()
plt.show()
```

For understand the questions more closely try to use matlab code:

```
clear all;
close all;
rand_len = rand(1,500);
rand_space = rand(1,500);
last_pos = 0.0;

figure;
hold on;
for i=1:length(rand_len)
plot([last_pos, last_pos + 10*rand_len(i)],[1,1],'k-','LineWidth', 3);
last_pos = last_pos + 10*rand_len(i) + 1000*rand_space(i);
end;
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior with the Python example using matplotlib.pyplot.plot and pyplot.show, then compare the plotted x coordinates with the MATLAB example. Trace how the supplied coordinates and axis limits are rendered; done means explaining the differing result or identifying a concrete, testable matplotlib change.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.