i'm trying to plot line chart using Matplotlib and mpld3 with Django . its working properly but if i hit refresh button in browser to reload the page suddenly server getting stopped with error message
[Segmentation fault (core dumped)]
bellow i mentioned my code . thanks in advance !!
in views.py :
from django.shortcuts import render
from django.http import HttpResponse
import matplotlib.pyplot as plt , mpld3
def index(request):
fig = plt.figure()
plt.plot([1,2,3,4,5],[5,4,3,2,1],'r--')
g = mpld3.fig_to_html(fig)
return render(request,'index.html',{'a' : g})