text_html_output_1.png
import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import plotly.express as px

import plotly.graph_objects as go

ci = pd.read_csv('../input/farmers-markets-in-the-united-states/wiki_county_info.csv')
fm = pd.read_csv('../input/farmers-markets-in-the-united-states/farmers_markets_from_usda.csv')

import plotly.express as px

# create a DataFrame with the count of farmers markets by state
state_farms = pd.DataFrame(fm['State'].value_counts())

# rename the column 'State' to 'Number of farmers markets'
state_farms.rename(columns={'State':'Number of farmers markets'}, inplace = True)

# create a bar chart 
fig = px.bar(
    state_farms,
    x=state_farms.index,
    y='Number of farmers markets',
    color='Number of farmers markets',  # Assign colors based on the number of farmers markets
    color_continuous_scale='Blues',  # Set the color scale
    title='Number of Farmers Markets by State'
)

# change visual style
fig.update_layout(
    xaxis_title='State',
    yaxis_title='Number of Farmers Markets',
    plot_bgcolor='white',  # Set the background color of the plot
    showlegend=False  # Hide the legend
)

# show the bar chart
fig.show()

import plotly.graph_objects as go
fig = go.Figure(data=go.Scattergeo(lon=fm['x'], lat=fm['y'], mode='markers', marker=dict(size=1, opacity=1, reversescale=True, autocolorscale=False, symbol=0, line=dict(width=1, color='rgba(102, 102, 102)'), colorscale='icefire', cmin=0)))
fig.update_layout(title='US farmers markets', geo_scope='usa')
fig.show()