Home

Sunday, December 25, 2016

Set Min Max Axis Limit in Matplotlib Plot

To set the minimum maximum limit axis first we need to get axes from the plot by using plt.gca() and then use set_xlim([xmin,xmax]) to set min max of x-axis and set_ylim([ymin,ymax]) to set min max of y-axis as follow.

plt.gca() function is abbreviation from get current axes which return the class object of matplotlib.axes.Axes


import numpy as np
import matplotlib.pyplot as plt

plt.plot(x,y)

axes = plt.gca()
axes.set_xlim([xmin,xmax])
axes.set_ylim([ymin,ymax])

plt.show()

Sunday, September 25, 2016

Python Matplotlib tight_plot() max() arg is an empty sequence

Python Matplotlib tight_plot() max() arg is an empty sequence

Solution:
Place the plt.tight_plot()  after the plt.subplot and before plt.show()

as follow

plt.figure()

plt.subplot(2,1,1)
...

plt.subplot(2,1,2)
...

plt.tight_layout()
plt.show()

Monday, July 25, 2016

Full Width yii\bootstrap\navbar yii2

Full Width yii\bootstrap\navbar yii2 To make full width of yii\bootstrap\navbar just set the property renderInnerContainer to false as follow

<?php
    NavBar::begin([
        'brandLabel' => 'Aplikasi Sistem Billing Emerald Towers',
        'brandUrl' => Yii::$app->homeUrl,
        'renderInnerContainer'=>false,
        'options' => [
            'class' => 'navbar-default container-fluid',
        ],
    ]);
    echo Nav::widget([
        'options' => ['class' => 'navbar-nav navbar-right'],
        'items' => [
            ['label' => 'Home', 'url' => ['/site/index']],
            ['label' => 'Ganti Password', 'url' => ['/user/changepassword']],        
            Yii::$app->user->isGuest ? (
                ['label' => 'Login', 'url' => ['/site/login']]
            ) : (
                '<li>'
                . Html::beginForm(['/site/logout'], 'post', ['class' => 'navbar-form'])
                . Html::submitButton(
                    'Logout (' . Yii::$app->user->identity->username . ')',
                    ['class' => 'btn btn-link']
                )
                . Html::endForm()
                . '</li>'
            )
        ],
    ]);
    NavBar::end();
    ?>

Saturday, May 28, 2016

CardView Tidak Terdeteksi Pada Android Studio

Cara memperbaiki CardView yang tidak terdeteksi adalah dengan menambahkan compile 'com.android.support:cardview-v7:21.0.0-rc1' pada berkas build.gradle seperti di bawah ini dependencies { ... compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:cardview-v7:23.4.0' compile 'com.android.support:design:23.4.0' }

Friday, April 29, 2016