Skip to content

[WIP/Proof of concept] Fix Collection autolim issue #13640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Mar 9, 2019

PR Summary

A fix like this gets a lot of the issues with auto-lim for scatter by pre-setting the limits that make transData just based on the object's offsets, and then doing the full algorithm.

This is really a proof of concept for discussion rather than a full PR.... ping @anntzer @efiring @ImportanceOfBeingErnest

#7413

See also:
#13593

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

df = pd.DataFrame({'Depth': [0.2, 0.4, 0.4, 0.4, 0.4, 0.4, 0.6, 0.4, 3.2, 2.0],
                   'DateTimeUTC': [pd.Timestamp('2018-03-28 06:25:08'),
                                   pd.Timestamp('2018-03-28 06:25:49'),
                                   pd.Timestamp('2018-03-28 06:27:06'),
                                   pd.Timestamp('2018-03-28 06:32:11'),
                                   pd.Timestamp('2018-03-28 06:32:59'),
                                   pd.Timestamp('2018-03-28 06:34:02'),
                                   pd.Timestamp('2018-03-28 06:35:38'),
                                   pd.Timestamp('2018-03-28 06:37:04'),
                                   pd.Timestamp('2018-03-28 06:39:08'),
                                   pd.Timestamp('2018-03-28 06:40:52')]})

x = np.asarray(df['DateTimeUTC'])
y = np.asarray(df['Depth'])

fig, axs = plt.subplots(2, 1)

ax = axs[0]
#pp = ax.plot(x, y, '.')
ax.scatter(x, y, s=25, marker='d')
ax.set_title("using scatter")

ax = axs[1]
ax.plot(x, y)
ax.set_title("Using plot")

fig.tight_layout()
plt.show()

Before

Figure_2

After

Figure_1

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@jklymak
Copy link
Member Author

jklymak commented Mar 10, 2019

Closed in lieu of #13642

@jklymak jklymak closed this Mar 10, 2019
@jklymak jklymak deleted the fix-scatter-autolim-issue branch March 11, 2019 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant