Feature request: colormap with background
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- python
- Bereich
- data-visualization
Rechercherichtung
Beginne mit der Untersuchung der branca.colormap-Klassen und des für das Beispiel verwendeten generierten Colormap-HTML. Verfolge, wie die Colormap gerendert wird, und ermittle, wo ein optionales Hintergrundrechteck dargestellt werden kann; abgeschlossen ist dies, wenn das bestehende Beispiel eine auswählbare Hintergrundfarbe unterstützt, ohne die Farbzuordnung zu ändern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Code Sample
import folium
import pandas as pd
import folium.plugins
import branca
import branca.colormap as cm
data = [
[33.823400, -118.12194, 99.23],
[33.823500, -118.12294, 95.23],
[33.823600, -118.12394, 91.23],
[33.823700, -118.12494, 90.00]
]
df = pd.DataFrame(data, columns=['latitude','longitude','data'])
x_start = (df['latitude'].max() + df['latitude'].min()) / 2
y_start = (df['longitude'].max() + df['longitude'].min()) / 2
start_coord = (x_start, y_start)
colormap = cm.LinearColormap(colors=['red','lightblue'],
index=[df['data'].min(),df['data'].max()],
vmin=df['data'].min(),vmax=df['data'].max())
colormap.caption = 'Data [units]'
map = folium.Map(location=start_coord, zoom_start=12)
lat = list(df.latitude)
lon = list(df.longitude)
dat = list(df.data)
for loc, p in zip(zip(lat, lon), dat):
folium.Circle(
location=loc,
radius=10,
fill=True,
color=colormap(p),
fill_opacity=0.7
).add_to(map)
map.add_child(colormap)
map.save('index.html')
Problem description
Code above creates colored points, and displays a colormap to show what data value each color corresponds to. This is great but it would be even better if a background colour could be selected. This slightly hacky work-around does exactly what I want:
https://stackoverflow.com/a/50427006/4988601
I'd be happy to try and plumb this into folium itself if a few people show some interest in this feature (I'm fairly new to folium so any pointers on what methods/classes I'd need to poke around in would be appreciated).
Expected Output
Colormap with an optional background color rectangle to help it stand out.
Output of folium.__version__
0.10.0
- Vorherrschende Sprache
- Python
- Sterne
- 134
- Forks
- 69
- Ø Merge
- 1 Std. 10 Min.
- Gemergte PRs (30 T.)
- 1
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus python-visualization/branca
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 58/100
python-visualization/branca#222 · 1 Kommentar ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
python-visualization/branca#213 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 42/100
python-visualization/branca#195 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 45/100
python-visualization/branca#190 · 6 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
python-visualization/branca#182 ·
Alle Issues in python-visualization/branca
Ähnliche Issues
-
bug confirmed issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
open-webui/open-webui#30750 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
good first issue
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100