Open michkowalczuk opened 1 year ago
I plan to add a feature to make this easier in the future, but you can use the "multiplot" feature to use several different palettes in the same map. I think you could create a Subplot() with the regular map and a second Subplot() with the color palette you want to use (can contain a single color) and use the "postprocessing" keyword to filter the building you want to color differently.
See the last example in the README tutorial on how to use the "multiplot" feature:
# Draw several regions on the same canvas
prettymaps.multiplot(
prettymaps.Subplot(
'Cidade Baixa, Porto Alegre',
style={'building': {'palette': ['#49392C', '#E1F2FE', '#98D2EB']}}
),
prettymaps.Subplot(
'Bom Fim, Porto Alegre',
style={'building': {'palette': ['#BA2D0B', '#D5F2E3', '#73BA9B', '#F79D5C']}}
),
prettymaps.Subplot(
'Farroupilha, Porto Alegre',
style={'building': {'palette': ['#EEE4E1', '#E7D8C9', '#E6BEAE']}}
),
# Load a global preset
preset='cb-bf-f',
# Figure size
figsize=(12, 12)
)
Hi, Great thank you for the reply! This is the way I tried to do it, but the problem that I found was selecting only one building. I saw the postprocessing parameter but I didn’t find an example how to use it 🤷♂️
All the best ! Michal
W dniu wt., 21.03.2023 o 11:50 Marcelo de Oliveira Rosa Prates < @.***> napisał(a):
I plan to add a feature to make this easier in the future, but you can use the "multiplot" feature to use several different palettes in the same map. I think you could create a Subplot() with the regular map and a second Subplot() with the color palette you want to use (can contain a single color) and use the "postprocessing" keyword to filter the building you want to color differently.
See the last example in the README tutorial on how to use the "multiplot" feature:
Draw several regions on the same canvas
prettymaps.multiplot( prettymaps.Subplot( 'Cidade Baixa, Porto Alegre', style={'building': {'palette': ['#49392C', '#E1F2FE', '#98D2EB']}} ), prettymaps.Subplot( 'Bom Fim, Porto Alegre', style={'building': {'palette': ['#BA2D0B', '#D5F2E3', '#73BA9B', '#F79D5C']}} ), prettymaps.Subplot( 'Farroupilha, Porto Alegre', style={'building': {'palette': ['#EEE4E1', '#E7D8C9', '#E6BEAE']}} ),
Load a global preset
preset='cb-bf-f', # Figure size figsize=(12, 12)
)
You could use
— Reply to this email directly, view it on GitHub https://github.com/marceloprates/prettymaps/issues/114#issuecomment-1477622740, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFUL2QVZCFEDPL3DPG63ZDDW5GBW7ANCNFSM6AAAAAAWBXXKJI . You are receiving this because you authored the thread.Message ID: @.***>
Sorry! I really should include an example in the tutorial on how to use the postprocessing parameter. But basically, postprocessing
should be a function that takes a dict of GeoDataFrames as input, modifies it and returns it. For example:
def postprocessing(gdfs):
all_buildings = gdf['buildings']
my_building = all_buildings[(all_buildings["addr:street"]=="my street name") & (buildings["addr:housenumber"]=="my house number")]
gdfs['buildings'] = my_building
return gdfs
Great! It should be sufficient. I will try and let you know.
Once again thanks for your support 😊
W dniu wt., 21.03.2023 o 12:28 Marcelo de Oliveira Rosa Prates < @.***> napisał(a):
Sorry! I really should include an example in the tutorial on how to use the postprocessing parameter. But basically, postprocessing should be a function that takes a dict of GeoDataFrames as input, modifies it and returns it. For example:
def postprocessing(gdfs): all_buildings = gdf['buildings'] my_building = all_buildings[(all_buildings["addr:street"]=="my street name") & (buildings["addr:housenumber"]=="my house number")] gdfs['buildings'] = my_building return gdfs
— Reply to this email directly, view it on GitHub https://github.com/marceloprates/prettymaps/issues/114#issuecomment-1477673062, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFUL2QVBLKVUZ7EGDOPEI7LW5GGHFANCNFSM6AAAAAAWBXXKJI . You are receiving this because you authored the thread.Message ID: @.***>
How can I set a different color only for one building? I can find this building using geodataframe query, but what next? Any ideas?
buildings = plot.geodataframes["building"]
my_building = buildings[(buildings["addr:street"]=="my street name") & (buildings["addr:housenumber"]=="my house number")]