News Examples Installation SourceForge.net project page Doxygen Pydoc Epydoc

2008-03-11-basic-scatterplot

models.py

from dataplot import plotmodels as models
from dataplot import R
 
class PlayerManager(models.Manager):
    def SquareScatter_args(self):
        qs=self.filter(games__gte=5)
        return {
            'y':[x.team_goals_per_game for x in qs],
            'ylab':"Team goals per game",
            'x':[x.goals_per_game for x in qs],
            'xlab':"Goals per game",
            'main':"Your contribution to your team's goals",
            'ann':[x.name for x in qs],
            }
 
class Player(models.Model):
    name=models.CharField(max_length=100,unique=True)
    goals_per_game=models.FloatField()
    team_goals_per_game=models.FloatField()
    games=models.IntegerField()
 
    objects=PlayerManager()
 
    MANAGER_DATAPLOTS=[
        R.SquareScatter,
        ]
 

views.py

from django.shortcuts import render_to_response
from dataplot.soccer import models
 
def plots(request):
    return render_to_response(
        'soccer/plots.html',{'plot':models.Player.objects.SquareScatter})
 

template.html

{{plot.to_html}}
 

List of examples

2008-03-22-multiple-timeseries
2008-03-11-basic-timeseries
2008-03-11-basic-scatterplot
\n\n\n
2008-03-22-multiple-timeseries
2008-03-11-basic-timeseries
2008-03-11-basic-scatterplot
Hosted by SF-Logo