Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/musatahawar/interactive-bar-chart
This Python script demonstrates how to create an interactive bar graph using the Plotly library. The script allows users to visualize data in a dynamic and interactive way.
https://github.com/musatahawar/interactive-bar-chart
bar-graph interactive-visualizations plotly python python-bar-graph python3
Last synced: 5 days ago
JSON representation
This Python script demonstrates how to create an interactive bar graph using the Plotly library. The script allows users to visualize data in a dynamic and interactive way.
- Host: GitHub
- URL: https://github.com/musatahawar/interactive-bar-chart
- Owner: MusaTahawar
- Created: 2023-11-28T08:13:00.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-28T08:15:23.000Z (about 1 year ago)
- Last Synced: 2024-11-09T17:18:56.576Z (2 months ago)
- Topics: bar-graph, interactive-visualizations, plotly, python, python-bar-graph, python3
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Interactive Bar Graph with Plotly
This Python script demonstrates how to create an interactive bar graph using the Plotly library. The script allows users to visualize data in a dynamic and interactive way.
## Requirements
- Python 3.x
- Plotly library (`pip install plotly`)## Usage
1. Install the necessary Python packages:
```bash
pip install plotly
```2. Modify the script by updating the `categories` and `values` lists with your own data:
```python
categories = ['Category A', 'Category B', 'Category C', 'Category D']
values = [23, 45, 56, 78]
```3. Run the Python script:
```bash
python interactive_bar_graph.py
```4. The script will generate an interactive bar graph using Plotly. The graph will be displayed in your default web browser.
## Customization
- Modify the `categories` and `values` lists to represent your own dataset.
- Adjust colors, titles, axes labels, and other graph properties by modifying the parameters in the script's `update_layout` and `go.Figure` sections.## Example
Here's a snippet of how to create the bar graph:
```python
import plotly.graph_objects as go# Sample data
categories = ['Category A', 'Category B', 'Category C', 'Category D']
values = [23, 45, 56, 78]# Create a bar graph
fig = go.Figure(data=[go.Bar(
x=categories,
y=values,
marker_color='skyblue' # Change color as needed
)])# Update graph layout for better visualization
fig.update_layout(
title='Interactive Bar Graph',
xaxis=dict(title='Categories'),
yaxis=dict(title='Values'),
hovermode='closest'
)# Show the interactive graph
fig.show()
```## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details