Пример #1
0
def figure_deaths(count3):
    df2 = df.loc[(df['State/UnionTerritory'] == count3)]
    return px.area(df2,
                   x="Date",
                   y="Cured",
                   color="State/UnionTerritory",
                   line_group="State/UnionTerritory")
Пример #2
0
def figure_deaths(count3):
    # count3 = "World"
    df2 = df.loc[(df['location'] == count3)]
    return px.area(df2,
                   x="date",
                   y="total_deaths",
                   color="location",
                   line_group="location")


#
# @app.callback(
# Output("cases_or_deaths_country","figure"),
#     [Input("countries","value"), Input("columns","value")]
# )
# def density_fig(ch1, ch2):
#     df3 = df.loc[df["location"].isin(ch1)]
#     return px.area(
#         df3, x="date", y=ch2, color="location", line_group="location"
#     )
#
# @app.callback(
# Output("total_cases_or_deaths_country","figure"),
#     [Input("countries","value"), Input("columns","value")]
# )
# def line_fig(ch1, ch2):
#     df3 = df.loc[df["location"].isin(ch1)]
#     return px.line(
#         df3, x="date", y=ch2, color="location", line_group="location"
#     )
Пример #3
0
def figure_case(count2):
    df2 = df.loc[(df['State/UnionTerritory'] == count2)]
    return px.area(df2,
                   x="Date",
                   y="Confirmed",
                   color="State/UnionTerritory",
                   line_group="State/UnionTerritory")
Пример #4
0
def figure_case(c2):
    # count2 = "World"
    df2 = df.loc[(df['location'] == c2)]
    return px.area(df2,
                   x="date",
                   y="total_cases",
                   color="location",
                   line_group="location")
Пример #5
0
def density_fig(ch1, ch2):
    df3 = df.loc[df["State/UnionTerritory"].isin(ch1)]

    return px.area(df3,
                   x="Date",
                   y=ch2,
                   color="State/UnionTerritory",
                   line_group="State/UnionTerritory")
Пример #6
0
        if plot_type == "bar":
            fig = px.bar(dfp,
                         x='Tahun',
                         y=selected_columns,
                         color=color_value,
                         barmode=mode)
            st.plotly_chart(fig)
        elif plot_type == "line":
            fig = px.line(dfp,
                          x='Tahun',
                          y=selected_columns,
                          color=color_value)
            st.plotly_chart(fig)
        elif plot_type == "area":
            fig = px.area(dfp,
                          x='Tahun',
                          y=selected_columns,
                          color=color_value)
        elif plot_type == "hist":
            fig = px.histogram(dfp, x=selected_columns)
            st.plotly_chart(fig)
        elif plot_type == "box":
            fig = px.box(dfp, y=selected_columns, x=xbox)
            st.plotly_chart(fig)
        elif plot_type:
            cust_plot = dfp[selected_columns].plot(kind=plot_type)
            st.write(cust_plot)
            st.pyplot()

    if st.checkbox("Budget Allocation vs Index Change Analysis"):
        # df = pd.read_csv('belanja_apbd.csv',sep=";")
        df = pd.read_excel('belanja_apbd_full.xlsx')
Пример #7
0
                ), ),
            html.Div(
                dcc.Graph(figure=px.box(
                    tmp,
                    x="amount",
                    y="Weekday",
                    orientation="h",
                    notched=True,
                    category_orders={
                        "Weekday": [
                            "Friday", "Saturday", "Sunday", "Monday",
                            "Tuesday", "Wednesday", "Thursday"
                        ]
                    }))),
            html.Div(
                dcc.Graph(figure=px.area(
                    tmp, x="Date", y="amount", color="Category")))
        ],
        className="two column",
        style={
            'width': '100%',
            'backgroundColor': 'blue'
        },
    ),
]


# hide/show modal
@app.callback(Output("trans_modal", "style"),
              [Input("add-new-btn", "n_clicks")])
def display_trans_modal_callback(n):
    if n > 0:
Пример #8
0
df = px.data.gapminder()

my_text = dcc.Markdown("""
    ## Dash Boostrap Practice App
    
    This app is a quickstart to developing your own app    
    - Use this Markdown component for your own text.  You can  
    learn more about how to format text such as  adding **bold** and 
    *italics*  [here](https://commonmark.org/help/tutorial/)    
    -  Use the cards  to create components and then add them to the layout.
    This figure is from the [Plotly Tutorial](https://plotly.com/python/plotly-express/)
    
""")

fig = px.area(df, x="year", y="pop", color="continent", line_group="country")

text_card = html.Div(
    dbc.Card(
        dbc.CardBody(
            [
                html.H4(" Card Title", className="card-title"),
                my_text,
            ],
            className="mt-4",
        )))

graph_card = html.Div(
    dbc.Card(
        dbc.CardBody(
            [
                        )
st.write(pc)
if st.checkbox("Show Principal Components", False):
    st.write(components)

# PRINCIPAL COMPONENTS EXPLAINED VARIANCE

pcafit = pca.fit(feature_set)
expvar = pca.explained_variance_ratio_

st.subheader("")
st.write("### Principal Components Explained Variance")
exp = px.area(
    x = range(0, 35),
    y = expvar,
    template = 'plotly_dark',
    height = 700,
    labels = {"x": "Principal Components", "y": "Explained Variance"}
        )
st.write(exp)

# 3-DIMENSIONAL PRINCIPAL COMPONENTS EXPLORATION

pca3 = PCA(n_components=3)
components3 = pca3.fit_transform(feature_set)

totalvar = pca3.explained_variance_ratio_.sum() * 100

st.title("")
st.subheader("Visualizing the Principal Components in 3 Dimensions")
pc3 = px.scatter_3d(
Пример #10
0
def density_fig(ch1, ch2):
    df3 = df.loc[df["location"].isin(ch1)]
    return px.area(
        df3, x="date", y=ch2, color="location", line_group="location"
    )
Пример #11
0
def figure_deaths(count3):
    df2 = df.loc[(df['location'] == count3)]
    return px.area(
        df2, x="date", y="total_deaths", color="location", line_group="location"
    )
Пример #12
0
    'dim1': 'year',
    'dim2': 'ryr',
    'dim3': 'trst',
    'dim4': 'lstkw',
    'dim5': 'level'
},
            inplace=True)
years = cars['year'].unique()

cars = cars.set_index(['ryr', 'trst', 'lstkw', 'year'])
#cars = cars.unstack(level='year')

cars_sum = cars.groupby(['trst', 'year']).sum().reset_index()
fig = px.line(cars_sum, x="year", y="level", color="trst", log_y=True)
fig2 = px.bar(cars_sum, x="year", y="level", color="trst")
fig3 = px.area(cars_sum, x="year", y="level", color="trst")

## Macro economic indicators
## Aggregated results
gdx_file = os.path.join(temp_dir, 'results.gdx')
db = ws.add_database_from_gdx(gdx_file)
results_agg = gdxt.get_parameter(db, 'results_agg')
results_agg.rename(columns={
    'dim1': 'year',
    'dim2': 'scenario',
    'dim3': 'indicator',
    'dim4': 'level'
},
                   inplace=True)
indicators = results_agg['indicator'].unique()
Пример #13
0
		
		col2.plotly_chart(fig1, use_column_width=True)
		
		col1.subheader('')
		col1.subheader('')
		col1.subheader('')	
		col1.subheader('')	
		col1.subheader('')	
		col1.subheader('')
		col1.subheader('Indicators')
					
		indicators = col1.selectbox('Choose Indicator',('Volume', 'RSI','MACD'))
		
		if indicators == 'Volume':
			
			fig2 = px.area(df, x = df.index, y = 'Volume',title=symbol)
			fig2.update_layout(xaxis_rangeslider_visible=True)
			col2.plotly_chart(fig2)

		if indicators == 'RSI':
			
			fig3 = go.Figure()
			fig3.add_trace(go.Scatter(x=RSI.index, y=RSI.values, mode='lines',line=dict(color='gray'), name = 'RSI'))
			fig3.update_layout(xaxis_rangeslider_visible=True)
			col2.plotly_chart(fig3,use_column_width=True)

		if indicators == 'MACD':
			
			fig4 = go.Figure()
			fig4.add_trace(go.Scatter(x=df.index, y=df['MACD'], mode='lines',line=dict(color='red'), name = 'MACD'))
			fig4.add_trace(go.Scatter(x=df.index, y=df['SIGNAL'], mode='lines',line=dict(color='blue'), name = 'SIGNAL LINE'))