小编Ton*_*y A的帖子

如何使用 sharex=True 在 catplot (kind='violin') 顶部绘制 seaborn catplot (kind='count')

到目前为止我已经尝试过以下代码:

# Import to handle plotting
import seaborn as sns

# Import pyplot, figures inline, set style, plot pairplot
import matplotlib.pyplot as plt

# Make the figure space
fig = plt.figure(figsize=(2,4))
gs = fig.add_gridspec(2, 4)
ax1 = fig.add_subplot(gs[0, :])
ax2 = fig.add_subplot(gs[1, :])

# Load the example car crash dataset
tips = sns.load_dataset("tips")

# Plot the frequency counts grouped by time
sns.catplot(x='sex', hue='smoker',
                                   kind='count',
                                   col='time',
                                   data=tips,
                                   ax=ax1)

# View the data
sns.catplot(x='sex', y='total_bill', hue='smoker',
                                                   kind='violin',
                                                   col='time',
                                                   split='True', 
                                                   cut=0, 
                                                   bw=0.25, 
                                                   scale='area', …
Run Code Online (Sandbox Code Playgroud)

python categorical-data seaborn

4
推荐指数
1
解决办法
6391
查看次数

具有多个定义的 C++11 模板类

总之,我想要一个模板类,它可以有一个 std::tuple 或整数类型的类成员。

我想做的事情的本质粘贴在下面。

    #include <tuple>
    #include <vector>
    #include <string>

    template<typename T>
    class DATA 
    {
        public:
        
            T value;
        
    };

    template<typename... T>
    class DATA 
    {
        public:
        
            std::tuple<T...> value;
        
    };

    int main(int argc, char *argv[])
    {               
        DATA<int> d1;
        
        d1.value = 10;
        
        DATA<int, std::string, std::vector<int>> d2;
        
        std::get<0>( d2.value ) = 100;
        std::get<1>( d2.value ) = "Hello World";
        std::get<2>( d2.value ).push_back(1);
        std::get<2>( d2.value ).push_back(2);
        std::get<2>( d2.value ).push_back(3);

        return 0;        
    }
Run Code Online (Sandbox Code Playgroud)

c++ templates class

0
推荐指数
1
解决办法
60
查看次数

标签 统计

c++ ×1

categorical-data ×1

class ×1

python ×1

seaborn ×1

templates ×1