Skip to content
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

Ref #1100 , tickmode set to invalid value in mpltools #1101

Merged
merged 1 commit into from
Aug 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plotly/matplotlylib/mpltools.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,13 @@ def prep_ticks(ax, index, ax_type, props):
else:
axis_dict['tick0'] = tick0
axis_dict['dtick'] = dtick
axis_dict['tickmode'] = False
axis_dict['tickmode'] = None
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to be explicit here and use 'auto' rather than None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you maybe help me to understand what is going on? Are you trying to catch the axis scaling properties {“linear”, “log”, “symlog”, “logit”} from matplotlib.axes.Axes.set_xscale (other axis respectively)? There is no auto option. Maybe None is treated as auto?
It seems like despite the tickmode is set to None, it is inferred later on, for example the parsed JSON shows:

'layout': {'autosize': False,
               'height': 360,
               'hovermode': 'closest',
               'margin': {'b': 41, 'l': 61, 'pad': 0, 'r': 79, 't': 14},
               'showlegend': False,
               'width': 434,
               'xaxis':{...
                         'type': 'linear',
                         ...},
               'yaxis': {'anchor': 'x',
                         ...
                         'type': 'linear',
                         ...}
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

btw, i chose None in the first place because of the code snippet axis_dict.pop('tickmode', None) in line 491.

elif scale == 'log':
try:
axis_dict['tick0'] = props['axes'][index]['tickvalues'][0]
axis_dict['dtick'] = props['axes'][index]['tickvalues'][1] - \
props['axes'][index]['tickvalues'][0]
axis_dict['tickmode'] = False
axis_dict['tickmode'] = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this should be tick mode of 'log'. Would you mind trying this out on a simple matplotlib figure with a log axis?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a matplotlib log example:
image
With None, it looks like:
image

and brings the warnings:

plotly.graph_objs.Annotation is deprecated. 
...
Converted non-base10 x-axis log scale to 'linear'
...
Dang! That path collection is out of this world. I totally don't know what to do with it yet! Plotly can only import path collections linked to 'data' coordinates

With log, it looks like:
image
Same warning as in the None setting here.
I cannot see a difference between None and setting to log. What should it then be?
Despite that, there are obviously troubles converting non base10 logs.

except (IndexError, TypeError):
axis_dict = dict(nticks=props['axes'][index]['nticks'])
base = axis.get_transform().base
Expand Down