我正在尝试通过将matplotlib与Pyspark集成来绘制条形图。我遇到错误

时间:2019-09-29 05:37:56

标签: matplotlib pyspark-dataframes

我试图在pyspark中使用matplotlib绘制条形图,但出现错误。

package org.foo;

public class AnAspect {

    public static void main(String[] args) {
        new AB().handle(null);
        new BC().handle(null);
        new AC().handle(null);
    }

}

aspect AnAspect1 {
    declare parents : AB extends ASupport;

    // can only insert a class into hierarchy, but org.foo.BSupport is not a subtype of org.foo.CSupport
    declare parents : ASupport extends BSupport;
}

aspect AnAspect2 {
    declare parents : BC extends BSupport;
    declare parents : BSupport extends CSupport;
}

aspect AnAspect3 {
    declare parents : AC extends ASupport;
    declare parents : ASupport extends CSupport;
}

class BC extends MyCallback {

}

class AC extends MyCallback {

}

class AB extends MyCallback {

}

class ASupport extends MyCallback {

    @Override
    public void handle(Object o) {
        System.out.println("ASupport");
        super.handle(o);
    }

}

class BSupport extends MyCallback {

    @Override
    public void handle(Object o) {
        System.out.println("BSupport");
        super.handle(o);
    }

}

class CSupport extends MyCallback {

    @Override
    public void handle(Object o) {
        System.out.println("CSupport");
        super.handle(o);
    }

}

abstract class MyCallback {

    public void handle(Object o) {
        System.out.println("===============");
    }

}
import matplotlib.pyplot as plt
%matplotlib inline
x_labels = violationcode_freq['Violation Code'].values
fig = violationcode_freq[['count']].plot(kind='bar', facecolor='lightblue')
fig.set_xticklabels(x_labels)
fig.set_title('Counts of trips by passenger count')
fig.set_xlabel('Passenger count in trips')
fig.set_ylabel('Trip counts')
plt.show()

0 个答案:

没有答案