コード例 #1
0
ファイル: models.py プロジェクト: toni1210/django_matplotlib
class CompositeModel(models.Model):
    
    # Plot piecewise line
    line_plot = MatplotlibFigureField(figure='plot_line',
                                      verbose_name='Line', silent=True)
    # Plot sine function
    sine_plot = MatplotlibFigureField(figure='plot_sine',
                                      verbose_name='Sine', silent=True)
    # Imshow demo
    imshow_demo = MatplotlibFigureField(figure='image_plot',
                                        verbose_name='Imshow demo', silent=True)

    # Pass arguments to plot
    with_args = MatplotlibFigureField(figure='plot_with_args',
                                      verbose_name="Args passed", silent=True,
                                      plt_args=([1, 4, 2], [5, 2, 1]),
                                      help_text="Arguments are passed to the plot "
                                      "using `plt_args` keyword."
                                    )
    # Countour plot as svg
    countour_plot = MatplotlibFigureField(figure='countour_plot',
                                    verbose_name="Contour plot", silent=True,
                                    plt_kwargs={"custom_title":
                                                "Custom figure title goes here..."
                                                }
                                    )
コード例 #2
0
class MyModelWithFigure(models.Model):
    # ... other fields
    # figures.py should be in the same directory where models.py is placed.
    # see  ./django_matplotlib/figures.py for example.
    fig = MatplotlibFigureField(figure='test_figure',
                                verbose_name='figure',
                                silent=True)
コード例 #3
0
ファイル: tests.py プロジェクト: toni1210/django_matplotlib
 def build_env(request):
     sample_model = create_model('SampleModel%s' % ind,
                                 fields={'figure': MatplotlibFigureField(**kw)},
                                 module='django_matplotlib',
                                 app_label='django_matplotlib')
     class SampleForm(forms.ModelForm):
         class Meta:
             model = sample_model
             fields = '__all__'
     response = test_view(request, SampleForm())
     return response
コード例 #4
0
class DataPlot(models.Model):
    figure = MatplotlibFigureField(figure='my_figure')
コード例 #5
0
ファイル: models.py プロジェクト: chamassi/py3_django_test
class MyModel(models.Model):
       figures = MatplotlibFigureField(figure='my_figure')
コード例 #6
0
ファイル: models.py プロジェクト: chamassi/py3_django_test
  name=models.CharField(max_length=100)
  title=models.CharField(max_length=3,choices=TITLE_CHOICES)
  birth_date=models.DateField(blank=True,null=True)

  def _str_(self):
    return self.name

class Book(forms.Model):
  nom=models.CharField(max_length=100)
  authors=models.ManyToManyField(Author)
  

class MyModel(models.Model):
       figures = MatplotlibFigureField(figure='my_figure')
       # Plot piecewise line
    line_plot = MatplotlibFigureField(figure='plot_line',
                                      verbose_name='Line', silent=True)
    # Plot sine function
    sine_plot = MatplotlibFigureField(figure='plot_sine',
                                      verbose_name='Sine', silent=True)
    # Imshow demo
    imshow_demo = MatplotlibFigureField(figure='image_plot',
                                        verbose_name='Imshow demo', silent=True)

    # Pass arguments to plot
    with_args = MatplotlibFigureField(figure='plot_with_args',
                                      verbose_name="Args passed", silent=True,
                                      plt_args=([1, 4, 2], [5, 2, 1]),
                                      help_text="Arguments are passed to the plot "
                                      "using `plt_args` keyword."
                                    )
    # Countour plot as svg
コード例 #7
0
class Signal(models.Model):
    line_plot = MatplotlibFigureField(figure='plot_line',
                                      verbose_name='Line',
                                      silent=True)