Skip to content
This repository has been archived by the owner on Sep 25, 2020. It is now read-only.

plot default type changes for no apparent reason #53

Open
alan-krumholz opened this issue May 12, 2020 · 5 comments
Open

plot default type changes for no apparent reason #53

alan-krumholz opened this issue May 12, 2020 · 5 comments

Comments

@alan-krumholz
Copy link

I'm Using:
https://github.com/looker-open-source/sdk-examples/blob/master/python/run_look_with_filters.py
To change the filter of a Look before retrieving the png of my visualization.

My Look visualization is an horizontal bar plot
when I do run_look('png')
The png shows the original horizontal bar plot

However when I use the code in:
https://github.com/looker-open-source/sdk-examples/blob/master/python/run_look_with_filters.py
to change the filter for my look the png comes back as a vertical bar plot instead

Is this a bug? can I make it give me back the original horizontal bar plot but with the new filter?

@joeldodge79
Copy link
Contributor

I assume you're creating a new query based of the old look.query but with the new filter? You also have to copy over the old query.vis_config (which that code doesn't do since it's just running the query outputting json). However... you may still run into this issue depending on how complicated your vis_config is.

also, for now you have to do like the example does and copy over attributes from old -> new query but we'll soon launch a feature that does that work for you.

@alan-krumholz
Copy link
Author

Thanks @joeldodge79! will give that a try.
Looking forward to the simpler feature :) (do let us know when that's out!)

@alan-krumholz
Copy link
Author

@joeldodge79
Not sure if related to that issue you linked, but the plots still not look the same even after I copy the vis_config over. Now both are showing horizontal bars (an improvement) but the plot format is all messed up now:

Original:
image

With new Query:
image

This is how vis_config looks like in the original look:

{'x_axis_gridlines': 'False',
 'y_axis_gridlines': 'True',
 'show_view_names': 'False',
 'show_y_axis_labels': 'True',
 'show_y_axis_ticks': 'True',
 'y_axis_tick_density': 'default',
 'y_axis_tick_density_custom': '5',
 'show_x_axis_label': 'True',
 'show_x_axis_ticks': 'True',
 'y_axis_scale_mode': 'linear',
 'x_axis_reversed': 'False',
 'y_axis_reversed': 'False',
 'plot_size_by_field': 'False',
 'trellis': '',
 'stacking': '',
 'limit_displayed_rows': 'False',
 'legend_position': 'center',
 'point_style': 'none',
 'show_value_labels': 'False',
 'label_density': '25',
 'x_axis_scale': 'auto',
 'y_axis_combined': 'True',
 'ordering': 'none',
 'show_null_labels': 'False',
 'show_totals_labels': 'False',
 'show_silhouette': 'False',
 'totals_color': '#808080',
 'type': 'looker_bar',
 'defaults_version': '1',
 'series_types': '{}'}

I'll play around with some of those values to see if I can get it to look the same

@alan-krumholz
Copy link
Author

alan-krumholz commented May 13, 2020

@joeldodge79 found the problem (I think it is a bug)
when you do look(x).query.vis_config all the boolean values in the dictionary come back as string
e,g, 'True' and 'False' rather than True and False (see comment above with the dictionary printed)

I manually changed all these in the dictionary before copying it over, and that fixed it

    vis = look(x).query.vis_config
    for k in vis.keys():
        if vis[k] == 'True':
            vis[k] = True
        if vis[k] == 'False':
            vis[k] = False

@joeldodge79
Copy link
Contributor

yep, that's the bug. glad that fix worked for you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants