Skip to content

ENH/REF: Accept style args; use plot, not scatter. #155

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

Merged
merged 4 commits into from
Oct 3, 2014

Conversation

danielballan
Copy link
Member

Now annotate uses plot, which is both faster and more flexible than scatter in this context. It accepts dictionaries in plot_style and imshow_style which override hard-coded defaults.

There is some funny-business with extent aimed at getting this:

image

not this:

image

@tacaswell if you know a better way, have at it!

@danielballan
Copy link
Member Author

Oops, the "good" and "bad" images are swapped, but you can see what I'm going for.

@tacaswell
Copy link
Member

Turn of auto-scaling in the axes before you do the plot or manually set the
limits to [-1/2, img.shap[..] + 1/2].

The default extent is to put the pixel centers on the integers which means
there is a 1/2 'bleed' out either direction. The auto-scaling from the
plot method tries to pick 'nice' limits that fall on integers .

On Thu, Sep 11, 2014 at 4:43 PM, Dan Allan notifications@github.com wrote:

Oops, the "good" and "bad" images are swapped, but you can see what I'm
going for.


Reply to this email directly or view it on GitHub
#155 (comment).

Thomas Caswell
tcaswell@gmail.com

@danielballan
Copy link
Member Author

OK, that makes sense. This is a leaner way to get the same result.

vmin=kwargs.get('vmin'), vmax=kwargs.get('vmax'))
ax.set_xlim(0, superimpose.shape[1]*mpp)
ax.set_ylim(0, superimpose.shape[0]*mpp)
ax.set_xlim(-0.5, (superimpose.shape[1] - 0.5) * mpp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need the mpp on the lower limit as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Updated.

On Fri, Sep 12, 2014 at 10:40 AM, Thomas A Caswell <notifications@github.com

wrote:

In trackpy/plots.py:

               vmin=kwargs.get('vmin'), vmax=kwargs.get('vmax'))
  •    ax.set_xlim(0, superimpose.shape[1]*mpp)
    
  •    ax.set_ylim(0, superimpose.shape[0]*mpp)
    
  •    ax.set_xlim(-0.5, (superimpose.shape[1] - 0.5) \* mpp)
    

you need the mpp on the lower limit as well


Reply to this email directly or view it on GitHub
https://github.com/soft-matter/trackpy/pull/155/files#r17482005.

@danielballan danielballan added this to the 0.2.3 milestone Sep 30, 2014
@@ -361,3 +384,20 @@ def plot_displacements(t, frame1, frame2, scale=1, ax=None, **kwargs):
ax.set_xlim(arrow_specs.x.min(), arrow_specs.x.max())
ax.set_ylim(arrow_specs.y.min(), arrow_specs.y.max())
return ax


def _normalize_kwargs(kwargs, kind='patch'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be pushed upstream....but that is neither here nor there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tacaswell added a commit that referenced this pull request Oct 3, 2014
ENH/REF : Accept style args; use plot, not scatter.
@tacaswell tacaswell merged commit 6636e7f into soft-matter:master Oct 3, 2014
danielballan added a commit to danielballan/trackpy that referenced this pull request Oct 3, 2014
tacaswell added a commit that referenced this pull request Oct 3, 2014
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.

2 participants