Wednesday, February 27, 2019

Broken . Python . World Map

Was headache for few days, in solving a very simple problem of data visualization : refresh the data, update map and zoom to the particular map area.

Well, sound easy but first it kept getting "cannot insert level_0" error when refreshing data....solution, drop the index when unpack dataframe before go for next calculation. A simple solution , but wasted a day.

Then 2nd problem, when data was updated, based on selected country, the map should redraw and zoom to that country. Another day gone for this. The solution, don't set x_range and y_range at the initial stage, let it auto set.

Plot=figure()

So when update data

Def update(attractive, old, new):
    Plot.x_range = Range1d(min, max)
    Plot.y_range = Range1d(min,max)

It redraw the plot to new x and y range, this is how map is zoomed to specific area.

After reading hundreds of posts and comments on online resources, stackoveflow , only then came out the solutions. To focus on problem, also not a good thing to.

She was coughing in the morning . I heard, I worried. But again I was over thought, must be.

No comments:

Post a Comment